Skip to content

Commit f79957a

Browse files
committed
[DSC-2256] Fixes after merge with DSpace 9.2
1 parent 12db363 commit f79957a

22 files changed

Lines changed: 4163 additions & 3639 deletions

File tree

package-lock.json

Lines changed: 750 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,15 @@
248248
"karma-mocha-reporter": "2.2.5",
249249
"md5": "^2.3.0",
250250
"ng-mocks": "^14.14.0",
251-
"ngx-export-as": "~1.18.0",
251+
"ngx-export-as": "~1.20.1",
252252
"ngx-mask": "14.2.4",
253253
"postcss": "^8.5",
254254
"postcss-import": "^14.0.0",
255255
"postcss-loader": "^4.0.3",
256256
"postcss-preset-env": "^7.4.2",
257+
"react": "^16.14.0",
258+
"react-copy-to-clipboard": "^5.1.0",
259+
"react-dom": "^16.14.0",
257260
"rimraf": "^6.1.2",
258261
"sass": "~1.94.2",
259262
"sass-loader": "^12.6.0",

src/app/core/browse/search-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ export class SearchManager {
145145
if (item.entityType === followMetadata.type) {
146146
if (isArray(followMetadata.metadata)) {
147147
followMetadata.metadata.forEach((metadata) => {
148-
Metadata.all(item.metadata, metadata, null, environment.followAuthorityMetadataValuesLimit)
148+
Metadata.all(item.metadata, metadata, null, null, false, environment.followAuthorityMetadataValuesLimit)
149149
.filter((metadataValue: MetadataValue) => Metadata.hasValidItemAuthority(metadataValue.authority))
150150
.forEach((metadataValue: MetadataValue) => uuidMap[metadataValue.authority] = metadataValue);
151151
});
152152
} else {
153-
Metadata.all(item.metadata, followMetadata.metadata, null, environment.followAuthorityMetadataValuesLimit)
153+
Metadata.all(item.metadata, followMetadata.metadata, null, null, false, environment.followAuthorityMetadataValuesLimit)
154154
.filter((metadataValue: MetadataValue) => Metadata.hasValidItemAuthority(metadataValue.authority))
155155
.forEach((metadataValue: MetadataValue) => uuidMap[metadataValue.authority] = metadataValue);
156156
}

src/app/cris-layout/pipes/ds-date.pipe.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55
Pipe,
66
PipeTransform,
77
} from '@angular/core';
8+
import { Observable } from 'rxjs';
9+
import { map } from 'rxjs/operators';
810

911
import { LocaleService } from '../../core/locale/locale.service';
1012
import {
@@ -29,9 +31,10 @@ export class DsDatePipe implements PipeTransform, OnDestroy {
2931
this.asyncPipe = new AsyncPipe(cdr);
3032
}
3133

32-
transform(value: string, ...params: any[]): string {
33-
const locale = this.localeService.getCurrentLanguageCode();
34-
return isValidDate(value) ? localeDate(value, locale) : value;
34+
transform(value: string, ...params: any[]): Observable<string> {
35+
return this.localeService.getCurrentLanguageCode().pipe(
36+
map((locale: string) => isValidDate(value) ? localeDate(value, locale) : value),
37+
);
3538
}
3639

3740
ngOnDestroy() {

src/app/footer/footer.component.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
AsyncPipe,
3-
DatePipe,
4-
} from '@angular/common';
1+
import { AsyncPipe } from '@angular/common';
52
import {
63
Component,
74
Inject,
@@ -11,6 +8,7 @@ import {
118
import { RouterLink } from '@angular/router';
129
import { TranslateModule } from '@ngx-translate/core';
1310
import {
11+
combineLatest,
1412
Observable,
1513
of,
1614
} from 'rxjs';
@@ -40,7 +38,6 @@ import { ThemedTextSectionComponent } from '../shared/explore/section-component/
4038
templateUrl: 'footer.component.html',
4139
imports: [
4240
AsyncPipe,
43-
DatePipe,
4441
RouterLink,
4542
ThemedTextSectionComponent,
4643
TranslateModule,
@@ -98,10 +95,10 @@ export class FooterComponent implements OnInit {
9895
style: '',
9996
};
10097
this.site = this.siteService.find().pipe(take(1));
101-
this.siteService.find().pipe(take(1)).subscribe(
102-
(site: Site) => {
98+
combineLatest([this.site, this.locale.getCurrentLanguageCode()]).subscribe(
99+
([site, language]: [Site, string]) => {
103100
this.hasSiteFooterSections = !isEmpty(site?.firstMetadataValue('cris.cms.footer',
104-
{ language: this.locale.getCurrentLanguageCode() }));
101+
{ language }));
105102
},
106103
);
107104
}

src/app/home-page/home-news/home-news.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import {
44
OnInit,
55
} from '@angular/core';
66
import { ActivatedRoute } from '@angular/router';
7-
import { Observable } from 'rxjs';
7+
import {
8+
combineLatest,
9+
Observable,
10+
} from 'rxjs';
811
import {
912
map,
1013
take,
@@ -56,10 +59,11 @@ export class HomeNewsComponent implements OnInit {
5659
this.site$ = this.route.data.pipe(
5760
map((data) => data.site as Site),
5861
);
59-
this.siteService.find().pipe(take(1)).subscribe(
60-
(site: Site) => {
62+
const site$ = this.siteService.find().pipe(take(1));
63+
combineLatest([site$, this.locale.getCurrentLanguageCode()]).subscribe(
64+
([site, language]: [Site, string]) => {
6165
this.hasHomeNewsMetadata = !isEmpty(site?.firstMetadataValue('cris.cms.home-news',
62-
{ language: this.locale.getCurrentLanguageCode() }));
66+
{ language }));
6367
},
6468
);
6569
}

src/app/home-page/home-page.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
AsyncPipe,
33
isPlatformServer,
4-
NgTemplateOutlet,
54
} from '@angular/common';
65
import {
76
Component,
@@ -13,6 +12,7 @@ import {
1312
import { ActivatedRoute } from '@angular/router';
1413
import {
1514
BehaviorSubject,
15+
combineLatest,
1616
Observable,
1717
of,
1818
} from 'rxjs';
@@ -61,6 +61,7 @@ import { ThemedHomeNewsComponent } from './home-news/themed-home-news.component'
6161
styleUrls: ['./home-page.component.scss'],
6262
templateUrl: './home-page.component.html',
6363
imports: [
64+
AsyncPipe,
6465
HomeCoarComponent,
6566
SuggestionsPopupComponent,
6667
ThemedBrowseSectionComponent,
@@ -140,10 +141,10 @@ export class HomePageComponent implements OnInit, OnDestroy {
140141
map((section) => section.componentRows),
141142
);
142143

143-
this.siteService.find().pipe(take(1)).subscribe(
144-
(site: Site) => {
144+
combineLatest([this.siteService.find().pipe(take(1)), this.locale.getCurrentLanguageCode()]).subscribe(
145+
([site, language]: [Site, string]) => {
145146
this.hasHomeHeaderMetadata = !isEmpty(site?.firstMetadataValue('cris.cms.home-header',
146-
{ language: this.locale.getCurrentLanguageCode() }));
147+
{ language }));
147148
},
148149
);
149150
}

src/app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import {
44
OnDestroy,
55
OnInit,
66
} from '@angular/core';
7-
import { RouterLink } from '@angular/router';
87
import {
98
TranslateModule,
109
TranslateService,
1110
} from '@ngx-translate/core';
1211
import {
1312
BehaviorSubject,
13+
combineLatest,
1414
Subscription,
1515
} from 'rxjs';
16+
import { take } from 'rxjs/operators';
1617

1718
import { SiteDataService } from '../../../core/data/site-data.service';
1819
import { LocaleService } from '../../../core/locale/locale.service';
@@ -28,7 +29,6 @@ import { MarkdownViewerComponent } from '../../../shared/markdown-viewer/markdow
2829
imports: [
2930
AsyncPipe,
3031
MarkdownViewerComponent,
31-
RouterLink,
3232
TranslateModule,
3333
],
3434
})
@@ -56,8 +56,8 @@ export class EndUserAgreementContentComponent implements OnInit, OnDestroy {
5656
}
5757

5858
ngOnInit(): void {
59-
this.subs.push(this.siteService.find().subscribe((site) => {
60-
const langCode = this.localeService.getCurrentLanguageCode();
59+
const site$ = this.siteService.find().pipe(take(1));
60+
this.subs.push(combineLatest([site$, this.localeService.getCurrentLanguageCode()]).subscribe(([site, langCode]) => {
6161
const fallbackLangCode = 'en';
6262

6363
const textArray = site?.metadataAsList.filter((metadata) => this.filterMetadata(metadata, langCode));

src/app/shared/explore/section-component/text-section/text-section.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@case ('text-metadata') {
1313
<div [class.text-section-home-news]="textRowSection.content === 'cris.cms.home-news'">
1414
<ds-markdown-viewer data-test="ds-markdown-viewer"
15-
[value]="metadataValue(textRowSection.content)"></ds-markdown-viewer>
15+
[value]="metadataValue(textRowSection.content) | async"></ds-markdown-viewer>
1616
</div>
1717
}
1818
@case ('custom') {

src/app/shared/explore/section-component/text-section/text-section.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { NgTemplateOutlet } from '@angular/common';
1+
import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
22
import {
33
Component,
44
Input,
55
} from '@angular/core';
66
import { TranslateModule } from '@ngx-translate/core';
7+
import { Observable } from 'rxjs';
8+
import { map } from 'rxjs/operators';
79

810
import { TextRowSection } from '../../../../core/layout/models/section.model';
911
import { LocaleService } from '../../../../core/locale/locale.service';
@@ -15,11 +17,11 @@ import { MarkdownViewerComponent } from '../../../markdown-viewer/markdown-viewe
1517
selector: 'ds-base-text-section',
1618
templateUrl: './text-section.component.html',
1719
styleUrls: ['./text-section.component.scss'],
18-
standalone: true,
1920
imports: [
2021
MarkdownViewerComponent,
2122
NgTemplateOutlet,
2223
TranslateModule,
24+
AsyncPipe,
2325
],
2426
})
2527
export class TextSectionComponent {
@@ -38,7 +40,9 @@ export class TextSectionComponent {
3840
) {
3941
}
4042

41-
metadataValue(content: string) {
42-
return this.site?.firstMetadataValue(content, { language: this.locale.getCurrentLanguageCode() }) ?? '';
43+
metadataValue(content: string): Observable<string> {
44+
return this.locale.getCurrentLanguageCode().pipe(
45+
map(language => this.site?.firstMetadataValue(content, { language }) ?? ''),
46+
);
4347
}
4448
}

0 commit comments

Comments
 (0)