Skip to content

Commit

Permalink
Merged in task/dspace-cris-2023_02_x/DSC-1867 (pull request DSpace#2167)
Browse files Browse the repository at this point in the history
Task/dspace cris 2023 02 x/DSC-1867

Approved-by: Andrea Barbasso
  • Loading branch information
atarix83 authored and Andrea Barbasso committed Aug 28, 2024
2 parents c4e09bf + 640b37d commit a063cbe
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
40 changes: 22 additions & 18 deletions src/app/menu.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { RemoteData } from './core/data/remote-data';
import { TextMenuItemModel } from './shared/menu/menu-item/models/text.model';
import { MenuService } from './shared/menu/menu.service';
import { filter, find, map, switchMap, take } from 'rxjs/operators';
import { hasValue } from './shared/empty.util';
import { hasValue, isNotEmpty } from './shared/empty.util';
import { FeatureID } from './core/data/feature-authorization/feature-id';
import {
ThemedCreateCommunityParentSelectorComponent
Expand Down Expand Up @@ -532,11 +532,11 @@ export class MenuResolver implements Resolve<boolean> {
];
menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, menuSection));

observableCombineLatest([
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_EXPORT_SCRIPT_NAME)
]).pipe(
filter(([authorized, metadataExportScriptExists]: boolean[]) => authorized && metadataExportScriptExists),
this.authorizationService.isAuthorized(FeatureID.AdministratorOf).pipe(
filter((authorized: boolean) => authorized),
take(1),
switchMap(() => this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_EXPORT_SCRIPT_NAME)),
filter((metadataExportScriptExists: boolean) => metadataExportScriptExists),
take(1)
).subscribe(() => {
// Hides the export menu for unauthorised people
Expand Down Expand Up @@ -617,20 +617,24 @@ export class MenuResolver implements Resolve<boolean> {
* Add the DL Exporter menu item to the admin menu
*/
createDLExporterMenuItem() {
observableCombineLatest([
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
this.getDLExporterURL(),
this.getDLExporterAccessToken()
]).subscribe(([authorized, url, accesstoken]) => {
console.log(accesstoken);
this.authorizationService.isAuthorized(FeatureID.AdministratorOf).pipe(
filter((authorized: boolean) => authorized),
take(1),
switchMap(() => observableCombineLatest([
this.getDLExporterURL(),
this.getDLExporterAccessToken()
])),
filter(([url, accesstoken]) => isNotEmpty(url) && isNotEmpty(accesstoken)),
take(1)
).subscribe(([url, accesstoken]) => {
const urlSegments = url.split('?');
const queryParamSegments = urlSegments[1].split('=');
this.menuService.addSection(MenuID.ADMIN,
{
id: 'loginmiur_dlexporter_url',
index: 15,
active: false,
visible: authorized && (hasValue(url) && url.length > 0) && (hasValue(accesstoken) && accesstoken.length > 0),
visible: true,
model: {
type: MenuItemType.LINK,
text: 'menu.section.loginmiur_dlexporter_url',
Expand All @@ -655,11 +659,11 @@ export class MenuResolver implements Resolve<boolean> {
const menuList = [];
menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, menuSection));

observableCombineLatest([
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_IMPORT_SCRIPT_NAME)
]).pipe(
filter(([authorized, metadataImportScriptExists]: boolean[]) => authorized && metadataImportScriptExists),
this.authorizationService.isAuthorized(FeatureID.AdministratorOf).pipe(
filter((authorized: boolean) => authorized),
take(1),
switchMap(() => this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_IMPORT_SCRIPT_NAME)),
filter((metadataImportScriptExists: boolean) => metadataImportScriptExists),
take(1)
).subscribe(() => {
// Hides the import menu for unauthorised people
Expand Down
2 changes: 1 addition & 1 deletion src/app/search-page/search-page.component.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<ds-themed-search [renderOnServerSide]="false" [showCharts]="true" [showCsvExport]="false" [showExport]="true" [trackStatistics]="true"></ds-themed-search>
<ds-themed-search [showCharts]="true" [showCsvExport]="false" [showExport]="true" [trackStatistics]="true"></ds-themed-search>
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export abstract class AbstractBrowseElementsComponent implements OnInit, OnChang
}

ngOnInit() {
const followLinks = this.followThumbnailLink ? [followLink('thumbnail')] : [];
const followLinks = this.followThumbnailLink ? [followLink('thumbnail'), followLink('metrics')] : [followLink('metrics')];
this.paginatedSearchOptionsBS = new BehaviorSubject<PaginatedSearchOptions>(this.paginatedSearchOptions);
this.searchResults$ = this.paginatedSearchOptionsBS.asObservable().pipe(
mergeMap((paginatedSearchOptions) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ export class DefaultBrowseElementsComponent extends AbstractBrowseElementsCompon

@Input() showLabel: boolean;

protected followThumbnailLink = true;
protected followThumbnailLink = this.appConfig.browseBy.showThumbnails;
}
6 changes: 3 additions & 3 deletions src/app/shared/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ export class SearchComponent implements OnInit, OnDestroy {
@Input() showFilterToggle = false;

/**
* Defines whether to show the toggle button to Show/Hide filter
* Defines whether to fetch search results during SSR execution
*/
@Input() renderOnServerSide = true;
@Input() renderOnServerSide = false;

/**
* Defines whether to show the toggle button to Show/Hide chart
Expand Down Expand Up @@ -448,7 +448,7 @@ export class SearchComponent implements OnInit, OnDestroy {
{
configuration: searchOptionsConfiguration,
sort: sortOption || searchOptions.sort,
forcedEmbeddedKeys: this.forcedEmbeddedKeys.get(searchOptionsConfiguration)
forcedEmbeddedKeys: this.forcedEmbeddedKeys.get(searchOptionsConfiguration) || this.forcedEmbeddedKeys.get('default')
});
if (combinedOptions.query === '') {
combinedOptions.query = this.query;
Expand Down

0 comments on commit a063cbe

Please sign in to comment.