mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 14:33:03 +00:00
[DURACOM-191] Fix error on home when coar is not enabled
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { getFirstSucceededRemoteData, getRemoteDataPayload } from '../../shared/operators';
|
import { getFirstCompletedRemoteData } from '../../shared/operators';
|
||||||
import { ConfigurationDataService } from '../../data/configuration-data.service';
|
import { ConfigurationDataService } from '../../data/configuration-data.service';
|
||||||
import { map, Observable } from 'rxjs';
|
import { map, Observable } from 'rxjs';
|
||||||
import { ConfigurationProperty } from '../../shared/configuration-property.model';
|
import { ConfigurationProperty } from '../../shared/configuration-property.model';
|
||||||
import { AuthorizationDataService } from '../../data/feature-authorization/authorization-data.service';
|
import { AuthorizationDataService } from '../../data/feature-authorization/authorization-data.service';
|
||||||
import { FeatureID } from '../../data/feature-authorization/feature-id';
|
import { FeatureID } from '../../data/feature-authorization/feature-id';
|
||||||
|
import { RemoteData } from '../../data/remote-data';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service to check COAR availability and LDN services information for the COAR Notify functionalities
|
* Service to check COAR availability and LDN services information for the COAR Notify functionalities
|
||||||
@@ -34,11 +35,8 @@ export class NotifyInfoService {
|
|||||||
*/
|
*/
|
||||||
getCoarLdnLocalInboxUrls(): Observable<string[]> {
|
getCoarLdnLocalInboxUrls(): Observable<string[]> {
|
||||||
return this.configService.findByPropertyName('ldn.notify.inbox').pipe(
|
return this.configService.findByPropertyName('ldn.notify.inbox').pipe(
|
||||||
getFirstSucceededRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
getRemoteDataPayload(),
|
map((responseRD: RemoteData<ConfigurationProperty>) => responseRD.hasSucceeded ? responseRD.payload.values : [])
|
||||||
map((response: ConfigurationProperty) => {
|
|
||||||
return response.values;
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,12 +6,13 @@ import { Site } from '../core/shared/site.model';
|
|||||||
import { environment } from '../../environments/environment';
|
import { environment } from '../../environments/environment';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { RecentItemListComponent } from './recent-item-list/recent-item-list.component';
|
import { RecentItemListComponent } from './recent-item-list/recent-item-list.component';
|
||||||
import { ThemedTopLevelCommunityListComponent } from './top-level-community-list/themed-top-level-community-list.component';
|
import {
|
||||||
|
ThemedTopLevelCommunityListComponent
|
||||||
|
} from './top-level-community-list/themed-top-level-community-list.component';
|
||||||
import { ThemedSearchFormComponent } from '../shared/search-form/themed-search-form.component';
|
import { ThemedSearchFormComponent } from '../shared/search-form/themed-search-form.component';
|
||||||
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
|
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
|
||||||
import { NgIf, AsyncPipe, NgClass } from '@angular/common';
|
import { AsyncPipe, isPlatformServer, NgClass, NgIf } from '@angular/common';
|
||||||
import { ThemedHomeNewsComponent } from './home-news/themed-home-news.component';
|
import { ThemedHomeNewsComponent } from './home-news/themed-home-news.component';
|
||||||
import { isPlatformServer } from '@angular/common';
|
|
||||||
import { ServerResponseService } from '../core/services/server-response.service';
|
import { ServerResponseService } from '../core/services/server-response.service';
|
||||||
import { NotifyInfoService } from '../core/coar-notify/notify-info/notify-info.service';
|
import { NotifyInfoService } from '../core/coar-notify/notify-info/notify-info.service';
|
||||||
import { LinkDefinition, LinkHeadService } from '../core/services/link-head.service';
|
import { LinkDefinition, LinkHeadService } from '../core/services/link-head.service';
|
||||||
@@ -20,6 +21,8 @@ import { isNotEmpty } from '../shared/empty.util';
|
|||||||
import { APP_CONFIG, AppConfig } from 'src/config/app-config.interface';
|
import { APP_CONFIG, AppConfig } from 'src/config/app-config.interface';
|
||||||
import { ConfigurationSearchPageComponent } from '../search-page/configuration-search-page.component';
|
import { ConfigurationSearchPageComponent } from '../search-page/configuration-search-page.component';
|
||||||
import { SuggestionsPopupComponent } from '../notifications/suggestions-popup/suggestions-popup.component';
|
import { SuggestionsPopupComponent } from '../notifications/suggestions-popup/suggestions-popup.component';
|
||||||
|
import { EMPTY } from 'rxjs/internal/observable/empty';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-home-page',
|
selector: 'ds-home-page',
|
||||||
styleUrls: ['./home-page.component.scss'],
|
styleUrls: ['./home-page.component.scss'],
|
||||||
@@ -48,13 +51,13 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
|||||||
// Get COAR REST API URLs from REST configuration
|
// Get COAR REST API URLs from REST configuration
|
||||||
// only if COAR configuration is enabled
|
// only if COAR configuration is enabled
|
||||||
this.notifyInfoService.isCoarConfigEnabled().pipe(
|
this.notifyInfoService.isCoarConfigEnabled().pipe(
|
||||||
switchMap((coarLdnEnabled: boolean) => {
|
switchMap((coarLdnEnabled: boolean) => coarLdnEnabled ? this.notifyInfoService.getCoarLdnLocalInboxUrls() : EMPTY /*{
|
||||||
if (coarLdnEnabled) {
|
if (coarLdnEnabled) {
|
||||||
return this.notifyInfoService.getCoarLdnLocalInboxUrls();
|
return this.notifyInfoService.getCoarLdnLocalInboxUrls();
|
||||||
}
|
}
|
||||||
})
|
}*/)
|
||||||
).subscribe((coarRestApiUrls: string[]) => {
|
).subscribe((coarRestApiUrls: string[]) => {
|
||||||
if (coarRestApiUrls.length > 0) {
|
if (coarRestApiUrls?.length > 0) {
|
||||||
this.initPageLinks(coarRestApiUrls);
|
this.initPageLinks(coarRestApiUrls);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user