Skip to content

Commit a063cbe

Browse files
atarix83Andrea Barbasso
authored andcommitted
Merged in task/dspace-cris-2023_02_x/DSC-1867 (pull request DSpace#2167)
Task/dspace cris 2023 02 x/DSC-1867 Approved-by: Andrea Barbasso
2 parents c4e09bf + 640b37d commit a063cbe

5 files changed

Lines changed: 28 additions & 24 deletions

File tree

src/app/menu.resolver.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { RemoteData } from './core/data/remote-data';
1111
import { TextMenuItemModel } from './shared/menu/menu-item/models/text.model';
1212
import { MenuService } from './shared/menu/menu.service';
1313
import { filter, find, map, switchMap, take } from 'rxjs/operators';
14-
import { hasValue } from './shared/empty.util';
14+
import { hasValue, isNotEmpty } from './shared/empty.util';
1515
import { FeatureID } from './core/data/feature-authorization/feature-id';
1616
import {
1717
ThemedCreateCommunityParentSelectorComponent
@@ -532,11 +532,11 @@ export class MenuResolver implements Resolve<boolean> {
532532
];
533533
menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, menuSection));
534534

535-
observableCombineLatest([
536-
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
537-
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_EXPORT_SCRIPT_NAME)
538-
]).pipe(
539-
filter(([authorized, metadataExportScriptExists]: boolean[]) => authorized && metadataExportScriptExists),
535+
this.authorizationService.isAuthorized(FeatureID.AdministratorOf).pipe(
536+
filter((authorized: boolean) => authorized),
537+
take(1),
538+
switchMap(() => this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_EXPORT_SCRIPT_NAME)),
539+
filter((metadataExportScriptExists: boolean) => metadataExportScriptExists),
540540
take(1)
541541
).subscribe(() => {
542542
// Hides the export menu for unauthorised people
@@ -617,20 +617,24 @@ export class MenuResolver implements Resolve<boolean> {
617617
* Add the DL Exporter menu item to the admin menu
618618
*/
619619
createDLExporterMenuItem() {
620-
observableCombineLatest([
621-
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
622-
this.getDLExporterURL(),
623-
this.getDLExporterAccessToken()
624-
]).subscribe(([authorized, url, accesstoken]) => {
625-
console.log(accesstoken);
620+
this.authorizationService.isAuthorized(FeatureID.AdministratorOf).pipe(
621+
filter((authorized: boolean) => authorized),
622+
take(1),
623+
switchMap(() => observableCombineLatest([
624+
this.getDLExporterURL(),
625+
this.getDLExporterAccessToken()
626+
])),
627+
filter(([url, accesstoken]) => isNotEmpty(url) && isNotEmpty(accesstoken)),
628+
take(1)
629+
).subscribe(([url, accesstoken]) => {
626630
const urlSegments = url.split('?');
627631
const queryParamSegments = urlSegments[1].split('=');
628632
this.menuService.addSection(MenuID.ADMIN,
629633
{
630634
id: 'loginmiur_dlexporter_url',
631635
index: 15,
632636
active: false,
633-
visible: authorized && (hasValue(url) && url.length > 0) && (hasValue(accesstoken) && accesstoken.length > 0),
637+
visible: true,
634638
model: {
635639
type: MenuItemType.LINK,
636640
text: 'menu.section.loginmiur_dlexporter_url',
@@ -655,11 +659,11 @@ export class MenuResolver implements Resolve<boolean> {
655659
const menuList = [];
656660
menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, menuSection));
657661

658-
observableCombineLatest([
659-
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
660-
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_IMPORT_SCRIPT_NAME)
661-
]).pipe(
662-
filter(([authorized, metadataImportScriptExists]: boolean[]) => authorized && metadataImportScriptExists),
662+
this.authorizationService.isAuthorized(FeatureID.AdministratorOf).pipe(
663+
filter((authorized: boolean) => authorized),
664+
take(1),
665+
switchMap(() => this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_IMPORT_SCRIPT_NAME)),
666+
filter((metadataImportScriptExists: boolean) => metadataImportScriptExists),
663667
take(1)
664668
).subscribe(() => {
665669
// Hides the import menu for unauthorised people
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<ds-themed-search [renderOnServerSide]="false" [showCharts]="true" [showCsvExport]="false" [showExport]="true" [trackStatistics]="true"></ds-themed-search>
1+
<ds-themed-search [showCharts]="true" [showCsvExport]="false" [showExport]="true" [trackStatistics]="true"></ds-themed-search>

src/app/shared/browse-most-elements/abstract-browse-elements.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export abstract class AbstractBrowseElementsComponent implements OnInit, OnChang
5555
}
5656

5757
ngOnInit() {
58-
const followLinks = this.followThumbnailLink ? [followLink('thumbnail')] : [];
58+
const followLinks = this.followThumbnailLink ? [followLink('thumbnail'), followLink('metrics')] : [followLink('metrics')];
5959
this.paginatedSearchOptionsBS = new BehaviorSubject<PaginatedSearchOptions>(this.paginatedSearchOptions);
6060
this.searchResults$ = this.paginatedSearchOptionsBS.asObservable().pipe(
6161
mergeMap((paginatedSearchOptions) =>

src/app/shared/browse-most-elements/default-browse-elements/default-browse-elements.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ export class DefaultBrowseElementsComponent extends AbstractBrowseElementsCompon
2020

2121
@Input() showLabel: boolean;
2222

23-
protected followThumbnailLink = true;
23+
protected followThumbnailLink = this.appConfig.browseBy.showThumbnails;
2424
}

src/app/shared/search/search.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ export class SearchComponent implements OnInit, OnDestroy {
236236
@Input() showFilterToggle = false;
237237

238238
/**
239-
* Defines whether to show the toggle button to Show/Hide filter
239+
* Defines whether to fetch search results during SSR execution
240240
*/
241-
@Input() renderOnServerSide = true;
241+
@Input() renderOnServerSide = false;
242242

243243
/**
244244
* Defines whether to show the toggle button to Show/Hide chart
@@ -448,7 +448,7 @@ export class SearchComponent implements OnInit, OnDestroy {
448448
{
449449
configuration: searchOptionsConfiguration,
450450
sort: sortOption || searchOptions.sort,
451-
forcedEmbeddedKeys: this.forcedEmbeddedKeys.get(searchOptionsConfiguration)
451+
forcedEmbeddedKeys: this.forcedEmbeddedKeys.get(searchOptionsConfiguration) || this.forcedEmbeddedKeys.get('default')
452452
});
453453
if (combinedOptions.query === '') {
454454
combinedOptions.query = this.query;

0 commit comments

Comments
 (0)