documentation update

This commit is contained in:
lotte
2018-07-26 15:26:54 +02:00
parent 38d1f6c85a
commit 16b85e081c
5 changed files with 80 additions and 6 deletions

View File

@@ -11,13 +11,28 @@ import { hasValue, isNotEmpty } from '../../shared/empty.util';
templateUrl: './search-labels.component.html',
})
/**
* Component that represents the labels containing the currently active filters
*/
export class SearchLabelsComponent {
/**
* Emits the currently active filters
*/
appliedFilters: Observable<Params>;
/**
* Initialize the instance variable
*/
constructor(private searchService: SearchService, private filterService: SearchFilterService) {
this.appliedFilters = this.filterService.getCurrentFrontendFilters();
}
/**
* Calculates the parameters that should change if a given value for the given filter would be removed from the active filters
* @param {string} filterField The filter field parameter name from which the value should be removed
* @param {string} filterValue The value that is removed for this given filter field
* @returns {Observable<Params>} The changed filter parameters
*/
getRemoveParams(filterField: string, filterValue: string): Observable<Params> {
return this.appliedFilters.pipe(
map((filters) => {
@@ -31,6 +46,9 @@ export class SearchLabelsComponent {
)
}
/**
* @returns {string} The base path to the search page
*/
getSearchLink() {
return this.searchService.getSearchLink();
}

View File

@@ -7,11 +7,6 @@ import { SortOptions } from '../../core/cache/models/sort-options.model';
import { SearchResult } from '../search-result.model';
import { PaginatedList } from '../../core/data/paginated-list';
/**
* This component renders a simple item page.
* The route parameter 'id' is used to request the item it represents.
* All fields of the item that should be displayed, are defined in its template.
*/
@Component({
selector: 'ds-search-results',
templateUrl: './search-results.component.html',
@@ -20,9 +15,28 @@ import { PaginatedList } from '../../core/data/paginated-list';
fadeInOut
]
})
/**
* Component that represents all results from a search
*/
export class SearchResultsComponent {
/**
* The actual search result objects
*/
@Input() searchResults: RemoteData<PaginatedList<SearchResult<DSpaceObject>>>;
/**
* The current configuration of the search
*/
@Input() searchConfig: SearchOptions;
/**
* The current sort options for the search
*/
@Input() sortConfig: SortOptions;
/**
* The current view mode for the search results
*/
@Input() viewMode: ViewMode;
}

View File

@@ -1,13 +1,25 @@
import { autoserialize, autoserializeAs } from 'cerialize';
/**
* Class representing possible values for a certain filter
*/
export class FacetValue {
/**
* The display value of the facet value
*/
@autoserializeAs(String, 'label')
value: string;
/**
* The number of results this facet value would have if selected
*/
@autoserialize
count: number;
/**
* The REST url to add this filter value
*/
@autoserialize
search: string;
}

View File

@@ -1,6 +1,24 @@
/**
* Enumeration containing all possible types for filters
*/
export enum FilterType {
/**
* Represents simple text facets
*/
text = 'text',
/**
* Represents date facets
*/
range = 'date',
/**
* Represents hierarchically structured facets
*/
hierarchy = 'hierarchical',
/**
* Represents binary facets
*/
boolean = 'standard'
}

View File

@@ -1,6 +1,9 @@
import { FilterType } from './filter-type.model';
import { autoserialize, autoserializeAs } from 'cerialize';
/**
*
*/
export class SearchFilterConfig {
@autoserialize
@@ -12,15 +15,24 @@
@autoserialize
hasFacets: boolean;
// @autoserializeAs(String, 'facetLimit') - uncomment when fixed in rest
@autoserializeAs(String, 'facetLimit')
pageSize = 5;
/**
* Defines if the item facet is collapsed by default or not on the search page
*/
@autoserialize
isOpenByDefault: boolean;
/**
* Minimum value possible for this facet in the repository
*/
@autoserialize
maxValue: string;
/**
* Maximum value possible for this facet in the repository
*/
@autoserialize
minValue: string;
/**