Skip to content

Commit a19ef43

Browse files
[DURACOM-426] refactor
1 parent be381eb commit a19ef43

7 files changed

Lines changed: 24 additions & 58 deletions

File tree

config/config.example.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ submission:
238238
# Icons to be displayed next to an authority controlled value, to give indication of the source.
239239
sourceIcons:
240240
# Example of configuration for authority logo based on sources.
241-
# The condigured icon will be displayed next to the authority value in submission and on item page or search results.
241+
# The configured icon will be displayed next to the authority value in submission and on item page or search results.
242242
- source: orcid
243243
- path: assets/images/orcid.logo.icon.svg
244244
# Fallback language in which the UI will be rendered if the user's browser language is not an active language
@@ -718,13 +718,6 @@ identifierSubtypes:
718718
iconPosition: IdentifierSubtypesIconPositionEnum.LEFT
719719
link: https://ror.org
720720

721-
# The maximum number of item to process when following authority metadata values.
722-
followAuthorityMaxItemLimit: 100
723-
724-
# The maximum number of metadata values to process for each metadata key
725-
# when following authority metadata values.
726-
followAuthorityMetadataValuesLimit: 5;
727-
728721
# When the search results are retrieved, for each item type the metadata with a valid authority value are inspected.
729722
# Referenced items will be fetched with a find all by id strategy to avoid individual rest requests to efficiently display the search results.
730723
followAuthorityMetadata:

src/app/core/data/external-source-data.service.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,4 @@ export class ExternalSourceDataService extends IdentifiableDataService<ExternalS
122122
public searchBy(searchMethod: string, options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<ExternalSource>[]): Observable<RemoteData<PaginatedList<ExternalSource>>> {
123123
return this.searchData.searchBy(searchMethod, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
124124
}
125-
126-
/**
127-
* Get an entry for an external source by given entry id
128-
* @param externalSourceId The id of the external source to fetch entries for
129-
* @param entryId The id of the entry to retrieve
130-
*/
131-
getExternalSourceEntryById(externalSourceId: string, entryId: string): Observable<RemoteData<ExternalSourceEntry>> {
132-
const href$ = this.getEntryIDHref(externalSourceId, entryId).pipe(
133-
isNotEmptyOperator(),
134-
distinctUntilChanged(),
135-
);
136-
137-
return this.findByHref(href$) as any;
138-
}
139125
}

src/app/core/shared/item.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class Item extends DSpaceObject implements ChildHALResource, HandleObject
100100
isWithdrawn: boolean;
101101

102102
/**
103-
* A boolean representing if this Item is currently withdrawn or not
103+
* A string representing the entity type of this Item
104104
*/
105105
@autoserializeAs(String, 'entityType')
106106
entityType: string;

src/app/core/shared/metadata.models.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable max-classes-per-file */
2-
import { hasValue } from '@dspace/shared/utils/empty.util';
32
import {
43
autoserialize,
54
Deserialize,
@@ -57,25 +56,6 @@ export class MetadataValue implements MetadataValueInterface {
5756
/** The authority confidence value */
5857
@autoserialize
5958
confidence: number;
60-
61-
/**
62-
* Returns true if this Metadatum's authority key starts with 'virtual::'
63-
*/
64-
get isVirtual(): boolean {
65-
return hasValue(this.authority) && this.authority.startsWith(VIRTUAL_METADATA_PREFIX);
66-
}
67-
68-
/**
69-
* If this is a virtual Metadatum, it returns everything in the authority key after 'virtual::'.
70-
* Returns undefined otherwise.
71-
*/
72-
get virtualValue(): string {
73-
if (this.isVirtual) {
74-
return this.authority.substring(this.authority.indexOf(VIRTUAL_METADATA_PREFIX) + VIRTUAL_METADATA_PREFIX.length);
75-
} else {
76-
return undefined;
77-
}
78-
}
7959
}
8060

8161
/** Constraints for matching metadata values. */

src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,14 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple
186186
this.isHierarchicalVocabulary$ = this.vocabulary$.pipe(
187187
filter((vocabulary: Vocabulary) => isNotEmpty(vocabulary)),
188188
map((vocabulary: Vocabulary) => vocabulary.hierarchical),
189-
tap((isHierarchical: boolean) => {
190-
if (this.model.value) {
191-
this.setCurrentValue(this.model.value, isHierarchical);
192-
}
193-
}),
194189
);
195190

191+
this.subs.push(this.isHierarchicalVocabulary$.subscribe((isHierarchical) => {
192+
if (this.model.value) {
193+
this.setCurrentValue(this.model.value, isHierarchical);
194+
}
195+
}));
196+
196197
this.subs.push(this.group.get(this.model.id).valueChanges.pipe(
197198
filter((value) => this.currentValue !== value))
198199
.subscribe((value) => {
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
<span class="d-flex align-items-center txt-value">
2-
@if ((orcidUrl$ | async)) {
3-
<a href="{{(orcidUrl$ | async)}}/{{metadataValue}}" target="_blank">
1+
@let hasBadge = hasOrcidBadge();
2+
@let orcidUrl = orcidUrl$ | async;
3+
4+
@if (hasBadge || orcidUrl) {
5+
<span class="d-flex align-items-center txt-value">
6+
@if (orcidUrl) {
7+
<a href="{{orcidUrl}}/{{metadataValue}}" target="_blank">
48
{{ metadataValue }}
59
</a>
610
} @else {
711
{{ metadataValue }}
812
}
913

10-
11-
@if (hasOrcidBadge()) {
14+
@if (hasBadge) {
1215
<img
1316
placement="top"
1417
ngbTooltip="{{ 'orcid.badge.tooltip' | translate }}"
1518
class="orcid-icon"
1619
alt="orcid-logo"
1720
src="assets/images/orcid.logo.icon.svg"/>
1821
}
19-
2022
</span>
23+
}

src/app/shared/metadata-link-view/metadata-link-view-orcid/metadata-link-view-orcid.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import {
55
OnInit,
66
} from '@angular/core';
77
import { ConfigurationDataService } from '@dspace/core/data/configuration-data.service';
8+
import { RemoteData } from '@dspace/core/data/remote-data';
89
import { ConfigurationProperty } from '@dspace/core/shared/configuration-property.model';
910
import { Item } from '@dspace/core/shared/item.model';
10-
import { getFirstSucceededRemoteDataPayload } from '@dspace/core/shared/operators';
11+
import { getFirstCompletedRemoteData } from '@dspace/core/shared/operators';
1112
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
1213
import { TranslateModule } from '@ngx-translate/core';
1314
import {
@@ -41,9 +42,11 @@ export class MetadataLinkViewOrcidComponent implements OnInit {
4142
this.orcidUrl$ = this.configurationService
4243
.findByPropertyName('orcid.domain-url')
4344
.pipe(
44-
getFirstSucceededRemoteDataPayload(),
45-
map((property: ConfigurationProperty) =>
46-
property?.values?.length > 0 ? property.values[0] : null,
45+
getFirstCompletedRemoteData(),
46+
map((propertyPayload: RemoteData<ConfigurationProperty>) =>
47+
propertyPayload.hasSucceeded ?
48+
(propertyPayload.payload?.values?.length > 0 ? propertyPayload.payload.values[0] : null)
49+
: null,
4750
),
4851
);
4952
this.metadataValue = this.itemValue.firstMetadataValue(

0 commit comments

Comments
 (0)