mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
w2p-86403 fix opensearch is disabled, router issues and links
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { Injectable, RendererFactory2, ViewEncapsulation, Inject } from '@angular/core';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
|
||||
/**
|
||||
* LinkHead Service injects <link> tag into the head element during runtime.
|
||||
*/
|
||||
@Injectable()
|
||||
export class LinkHeadService {
|
||||
constructor(
|
||||
|
@@ -14,10 +14,11 @@ import { environment } from '../../../../src/environments/environment';
|
||||
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
|
||||
import { SortOptions } from '../../core/cache/models/sort-options.model';
|
||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
|
||||
/**
|
||||
* The default pagination controls component.
|
||||
* The Rss feed button componenet.
|
||||
*/
|
||||
@Component({
|
||||
exportAs: 'rssComponent',
|
||||
@@ -41,6 +42,7 @@ export class RSSComponent implements OnInit, OnDestroy {
|
||||
private linkHeadService: LinkHeadService,
|
||||
private configurationService: ConfigurationDataService,
|
||||
private searchConfigurationService: SearchConfigurationService,
|
||||
private router: Router,
|
||||
protected paginationService: PaginationService) {
|
||||
}
|
||||
ngOnDestroy(): void {
|
||||
@@ -53,22 +55,22 @@ export class RSSComponent implements OnInit, OnDestroy {
|
||||
this.configurationService.findByPropertyName('websvc.opensearch.enable').pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
).subscribe((result) => {
|
||||
const enabled = Boolean(result.payload.values[0]);
|
||||
const enabled = (result.payload.values[0] === 'true');
|
||||
this.isEnabled$.next(enabled);
|
||||
});
|
||||
|
||||
this.searchConfigurationService.getCurrentQuery('').subscribe((query) => {
|
||||
this.sortOption$ = this.paginationService.getCurrentSort(this.searchConfigurationService.paginationID, null, true);
|
||||
this.sortOption$.subscribe((sort) => {
|
||||
this.uuid = this.groupDataService.getUUIDFromString(window.location.href);
|
||||
this.uuid = this.groupDataService.getUUIDFromString(this.router.url);
|
||||
|
||||
const route = environment.rest.baseUrl + this.formulateRoute(this.uuid, sort, query);
|
||||
|
||||
this.addLinks(route);
|
||||
this.linkHeadService.addTag({
|
||||
href: route,
|
||||
href: environment.rest.baseUrl + '/opensearch/service',
|
||||
type: 'application/atom+xml',
|
||||
rel: 'alternate',
|
||||
title: 'Sitewide Atom feed'
|
||||
rel: 'search',
|
||||
title: 'Dspace'
|
||||
});
|
||||
this.route$ = new BehaviorSubject<string>(route);
|
||||
});
|
||||
@@ -91,4 +93,20 @@ export class RSSComponent implements OnInit, OnDestroy {
|
||||
route = '/opensearch/' + route;
|
||||
return route;
|
||||
}
|
||||
|
||||
addLinks(route: string): void {
|
||||
this.linkHeadService.addTag({
|
||||
href: route,
|
||||
type: 'application/atom+xml',
|
||||
rel: 'alternate',
|
||||
title: 'Sitewide Atom feed'
|
||||
});
|
||||
route = route.replace('format=atom', 'format=rss');
|
||||
this.linkHeadService.addTag({
|
||||
href: route,
|
||||
type: 'application/rss+xml',
|
||||
rel: 'alternate',
|
||||
title: 'Sitewide RSS feed'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -174,6 +174,10 @@ import { DsSelectComponent } from './ds-select/ds-select.component';
|
||||
import { LogInOidcComponent } from './log-in/methods/oidc/log-in-oidc.component';
|
||||
import { ThemedItemListPreviewComponent } from './object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component';
|
||||
import { RSSComponent } from './rss-feed/rss.component';
|
||||
import { SearchObjects } from './search/models/search-objects.model';
|
||||
import { FacetConfigResponse } from './search/models/facet-config-response.model';
|
||||
import { SearchResult } from './search/models/search-result.model';
|
||||
import { FacetValues } from './search/models/facet-values.model';
|
||||
|
||||
const MODULES = [
|
||||
CommonModule,
|
||||
|
Reference in New Issue
Block a user