Commit 18c881a8 authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

Merge branch '133-search-put-dataset-when-only-one-dataset' into 'develop'

Resolve "[Search] Put `dataset` when only one dataset"

Closes #133

See merge request !148
parents d0bbff78 93806ab8
Pipeline #3170 passed with stages
in 8 minutes and 30 seconds
......@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [3.5.0] - 2020-xx
### Added
### Fixed
### Changed
- #133 => Change typo if only one dataset
## [3.4.0] - 2020-10
### Added
- #132 => Add reset cone search button in search multiple
......
<div *ngIf="datasetFamilyList.length == 1">
<div *ngIf="datasetFamilyList.length === 1">
<div class="border rounded my-2">
<p class="border-bottom bg-light text-primary py-4 pl-4">List of datasets</p>
<p *ngIf="getNbDatasetByFamily() === 1" class="border-bottom bg-light text-primary py-4 pl-4">Dataset</p>
<p *ngIf="getNbDatasetByFamily() > 1" class="border-bottom bg-light text-primary py-4 pl-4">List of datasets</p>
<ul class="p-0">
<li *ngFor="let dataset of getDatasetListByFamily(datasetFamilyList[0].id); last as isLast"
class="list-unstyled px-3 pt-3 pb-0">
......
......@@ -60,6 +60,11 @@ describe('[Search][Dataset] Component: DatasetTabsComponent', () => {
expect(testedComponent).toBeTruthy();
});
it('#getNbDatasetByFamily() should return the number of dataset for the only one dataset family', () => {
testedComponent.datasetFamilyList = [DATASET_FAMILY_LIST.find(f => f.id === 1)];
expect(testedComponent.getNbDatasetByFamily()).toBe(1);
});
it('#getDatasetListByFamily(idFamily) should filter datasets by idFamily', () => {
const filteredDatasetList: Dataset[] = testedComponent.getDatasetListByFamily(1);
expect(filteredDatasetList.length).toBe(1);
......
......@@ -23,6 +23,10 @@ export class DatasetTabsComponent {
dnameSelected: string;
getNbDatasetByFamily(): number {
return this.getDatasetListByFamily(this.datasetFamilyList[0].id).length;
}
getDatasetListByFamily(idFamily: number): Dataset[] {
return this.datasetList
.filter(d => d.id_dataset_family === idFamily)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment