mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
fixed an issue where a search result without hitlighlights would break the grid view
This commit is contained in:
@@ -26,7 +26,7 @@ export class SearchResponseParsingService implements ResponseParsingService {
|
|||||||
value: hhObject[key].join('...')
|
value: hhObject[key].join('...')
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return [];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
import { SearchResult } from '../../../+search-page/search-result.model';
|
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
import { Metadatum } from '../../../core/shared/metadatum.model';
|
import { Metadatum } from '../../../core/shared/metadatum.model';
|
||||||
import { isEmpty, hasNoValue, isNotEmpty } from '../../empty.util';
|
import { hasNoValue, isEmpty } from '../../empty.util';
|
||||||
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
||||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
import { Observable } from 'rxjs/Observable';
|
|
||||||
import { TruncatableService } from '../../truncatable/truncatable.service';
|
import { TruncatableService } from '../../truncatable/truncatable.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -24,7 +24,6 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
|
|||||||
|
|
||||||
getValues(keys: string[]): string[] {
|
getValues(keys: string[]): string[] {
|
||||||
const results: string[] = new Array<string>();
|
const results: string[] = new Array<string>();
|
||||||
if (isNotEmpty(this.object.hitHighlights)) {
|
|
||||||
this.object.hitHighlights.forEach(
|
this.object.hitHighlights.forEach(
|
||||||
(md: Metadatum) => {
|
(md: Metadatum) => {
|
||||||
if (keys.indexOf(md.key) > -1) {
|
if (keys.indexOf(md.key) > -1) {
|
||||||
@@ -32,7 +31,6 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
if (isEmpty(results)) {
|
if (isEmpty(results)) {
|
||||||
this.dso.filterMetadata(keys).forEach(
|
this.dso.filterMetadata(keys).forEach(
|
||||||
(md: Metadatum) => {
|
(md: Metadatum) => {
|
||||||
@@ -45,7 +43,6 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
|
|||||||
|
|
||||||
getFirstValue(key: string): string {
|
getFirstValue(key: string): string {
|
||||||
let result: string;
|
let result: string;
|
||||||
if (isNotEmpty(this.object.hitHighlights)) {
|
|
||||||
this.object.hitHighlights.some(
|
this.object.hitHighlights.some(
|
||||||
(md: Metadatum) => {
|
(md: Metadatum) => {
|
||||||
if (key === md.key) {
|
if (key === md.key) {
|
||||||
@@ -54,7 +51,6 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
if (hasNoValue(result)) {
|
if (hasNoValue(result)) {
|
||||||
result = this.dso.findMetadata(key);
|
result = this.dso.findMetadata(key);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user