Skip to content

Commit a77a7a4

Browse files
[DURACOM-455] refactor config property, add example
1 parent e738016 commit a77a7a4

6 files changed

Lines changed: 90 additions & 82 deletions

File tree

config/config.example.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,18 @@ layout:
706706
default:
707707
icon: fas fa-project-diagram
708708
style: text-success
709-
# If true the dowmload link in item page will rerendered as an advanced attachment, the view can be then configured with the config advancedAttachmentRendering
709+
# If true the download link in item page will be rendered as an advanced attachment, the view can be then configured with the layout.advancedAttachmentRendering config
710710
showDownloadLinkAsAttachment: true
711+
# Configuration for advanced attachment rendering in item pages. This controls how files are displayed when showDownloadLinkAsAttachment is enabled.
712+
# Each configuration maps a bundle name to specific metadata fields that should be displayed alongside the file.
713+
advancedAttachmentRendering:
714+
- bundle: ORIGINAL
715+
metadata:
716+
- dc.description
717+
- dc.title
718+
- bundle: LICENSE
719+
metadata:
720+
- dc.rights
711721

712722
# Configuration for customization of search results
713723
searchResults:

src/app/shared/bitstream-attachment/bitstream-attachment.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class BitstreamAttachmentComponent implements OnInit {
117117
protected readonly route: ActivatedRoute,
118118
@Inject(APP_CONFIG) protected appConfig: AppConfig,
119119
) {
120-
this.metadataConfig = this.appConfig.advancedAttachmentRendering.metadata;
120+
this.metadataConfig = this.appConfig.layout.advancedAttachmentRendering.metadata;
121121
}
122122

123123
ngOnInit() {

src/config/app-config.interface.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
import { AccessibilitySettingsConfig } from './accessibility-settings.config';
77
import { ActuatorsConfig } from './actuators.config';
88
import { AdminNotifyMetricsRow } from './admin-notify-metrics.config';
9-
import { AdvancedAttachmentRenderingConfig } from './advanced-attachment-rendering.config';
109
import { AuthConfig } from './auth-config.interfaces';
1110
import { BrowseByConfig } from './browse-by-config.interface';
1211
import { BundleConfig } from './bundle-config.interface';
@@ -74,7 +73,6 @@ interface AppConfig extends Config {
7473
accessibility: AccessibilitySettingsConfig;
7574
layout: LayoutConfig;
7675
searchResult: SearchResultConfig;
77-
advancedAttachmentRendering: AdvancedAttachmentRenderingConfig;
7876
}
7977

8078
/**

src/config/default-app-config.ts

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import { SearchResultConfig } from '@dspace/config/search-result-config.interfac
44
import { AccessibilitySettingsConfig } from './accessibility-settings.config';
55
import { ActuatorsConfig } from './actuators.config';
66
import { AdminNotifyMetricsRow } from './admin-notify-metrics.config';
7-
import {
8-
AdvancedAttachmentElementType,
9-
AdvancedAttachmentRenderingConfig,
10-
} from './advanced-attachment-rendering.config';
7+
import { AdvancedAttachmentElementType } from './advanced-attachment-rendering.config';
118
import { AppConfig } from './app-config.interface';
129
import { AuthConfig } from './auth-config.interfaces';
1310
import { BrowseByConfig } from './browse-by-config.interface';
@@ -752,6 +749,41 @@ export class DefaultAppConfig implements AppConfig {
752749
},
753750
],
754751
showDownloadLinkAsAttachment: true,
752+
advancedAttachmentRendering: {
753+
pagination: {
754+
enabled: true,
755+
elementsPerPage: 2,
756+
},
757+
metadata: [
758+
{
759+
name: 'dc.title',
760+
type: AdvancedAttachmentElementType.Metadata,
761+
truncatable: false,
762+
},
763+
{
764+
name: 'dc.type',
765+
type: AdvancedAttachmentElementType.Metadata,
766+
truncatable: false,
767+
},
768+
{
769+
name: 'dc.description',
770+
type: AdvancedAttachmentElementType.Metadata,
771+
truncatable: true,
772+
},
773+
{
774+
name: 'size',
775+
type: AdvancedAttachmentElementType.Attribute,
776+
},
777+
{
778+
name: 'format',
779+
type: AdvancedAttachmentElementType.Attribute,
780+
},
781+
{
782+
name: 'checksum',
783+
type: AdvancedAttachmentElementType.Attribute,
784+
},
785+
],
786+
},
755787
};
756788

757789
// Search result configuration for authority metadata processing
@@ -787,40 +819,5 @@ export class DefaultAppConfig implements AppConfig {
787819
],
788820
};
789821

790-
advancedAttachmentRendering: AdvancedAttachmentRenderingConfig = {
791-
pagination: {
792-
enabled: true,
793-
elementsPerPage: 2,
794-
},
795-
metadata: [
796-
{
797-
name: 'dc.title',
798-
type: AdvancedAttachmentElementType.Metadata,
799-
truncatable: false,
800-
},
801-
{
802-
name: 'dc.type',
803-
type: AdvancedAttachmentElementType.Metadata,
804-
truncatable: false,
805-
},
806-
{
807-
name: 'dc.description',
808-
type: AdvancedAttachmentElementType.Metadata,
809-
truncatable: true,
810-
},
811-
{
812-
name: 'size',
813-
type: AdvancedAttachmentElementType.Attribute,
814-
},
815-
{
816-
name: 'format',
817-
type: AdvancedAttachmentElementType.Attribute,
818-
},
819-
{
820-
name: 'checksum',
821-
type: AdvancedAttachmentElementType.Attribute,
822-
},
823-
],
824-
};
825822

826823
}

src/config/layout-config.interfaces.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { AdvancedAttachmentRenderingConfig } from './advanced-attachment-rendering.config';
12
import { Config } from './config.interface';
23

34
/**
@@ -67,4 +68,9 @@ export interface LayoutConfig extends Config {
6768
*/
6869
authorityRef: AuthorityRefConfig[];
6970
showDownloadLinkAsAttachment: boolean;
71+
/**
72+
* Configuration for advanced attachment rendering features.
73+
* Controls pagination and metadata display for bitstream attachments.
74+
*/
75+
advancedAttachmentRendering: AdvancedAttachmentRenderingConfig;
7076
}

src/environments/environment.test.ts

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -547,15 +547,48 @@ export const environment: BuildConfig = {
547547
},
548548
],
549549
showDownloadLinkAsAttachment: false,
550+
advancedAttachmentRendering: {
551+
pagination: {
552+
enabled: true,
553+
elementsPerPage: 2,
554+
},
555+
metadata: [
556+
{
557+
name: 'dc.title',
558+
type: AdvancedAttachmentElementType.Metadata,
559+
truncatable: false,
560+
},
561+
{
562+
name: 'dc.type',
563+
type: AdvancedAttachmentElementType.Metadata,
564+
truncatable: false,
565+
},
566+
{
567+
name: 'dc.description',
568+
type: AdvancedAttachmentElementType.Metadata,
569+
truncatable: true,
570+
},
571+
{
572+
name: 'size',
573+
type: AdvancedAttachmentElementType.Attribute,
574+
},
575+
{
576+
name: 'format',
577+
type: AdvancedAttachmentElementType.Attribute,
578+
},
579+
{
580+
name: 'checksum',
581+
type: AdvancedAttachmentElementType.Attribute,
582+
},
583+
],
584+
},
550585
},
551586

552587
searchResult: {
553588
authorMetadata: ['dc.contributor.author', 'dc.creator', 'dc.contributor.*'],
554589
followAuthorityMaxItemLimit: 100,
555-
556590
followAuthorityMetadataValuesLimit: 5,
557-
558-
followAuthorityMetadata: [
591+
followAuthorityMetadata: [
559592
{
560593
type: 'Publication',
561594
metadata: ['dc.contributor.author'],
@@ -570,40 +603,4 @@ export const environment: BuildConfig = {
570603
},
571604
],
572605
},
573-
574-
advancedAttachmentRendering: {
575-
pagination: {
576-
enabled: true,
577-
elementsPerPage: 2,
578-
},
579-
metadata: [
580-
{
581-
name: 'dc.title',
582-
type: AdvancedAttachmentElementType.Metadata,
583-
truncatable: false,
584-
},
585-
{
586-
name: 'dc.type',
587-
type: AdvancedAttachmentElementType.Metadata,
588-
truncatable: false,
589-
},
590-
{
591-
name: 'dc.description',
592-
type: AdvancedAttachmentElementType.Metadata,
593-
truncatable: true,
594-
},
595-
{
596-
name: 'size',
597-
type: AdvancedAttachmentElementType.Attribute,
598-
},
599-
{
600-
name: 'format',
601-
type: AdvancedAttachmentElementType.Attribute,
602-
},
603-
{
604-
name: 'checksum',
605-
type: AdvancedAttachmentElementType.Attribute,
606-
},
607-
],
608-
},
609606
};

0 commit comments

Comments
 (0)