Newer
Older
import { Component, Input } from '@angular/core';
import { RemoteData } from '../../core/data/remote-data';
import { DSpaceObject } from '../../core/shared/dspace-object.model';
import { fadeIn, fadeInOut } from '../../shared/animations/fade';
import { SearchOptions } from '../search-options.model';
import { SearchResult } from '../search-result.model';
import { PaginatedList } from '../../core/data/paginated-list';
import { ViewMode } from '../../core/shared/view-mode.model';
import { isNotEmpty } from '../../shared/empty.util';
@Component({
selector: 'ds-search-results',
templateUrl: './search-results.component.html',
/**
* Component that represents all results from a search
*/
export class SearchResultsComponent {
@Input() searchResults: RemoteData<PaginatedList<SearchResult<DSpaceObject>>>;
@Input() searchConfig: SearchOptions;
/**
* The current view mode for the search results
*/
/**
* Method to change the given string by surrounding it by quotes if not already present.
*/
surroundStringWithQuotes(input: string): string {
let result = input;
if (isNotEmpty(result) && !(result.startsWith('\"') && result.endsWith('\"'))) {
result = `"${result}"`;
}
return result;
}