Skip to content
Snippets Groups Projects
Commit d4721976 authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

Display datasets with cone search only => DONE

parent af4cbf36
No related branches found
No related tags found
2 merge requests!147Develop,!138Resolve "Display datasets with cone search enabled"
<div class="row">
<div *ngFor="let project of getProjectSortedByName()" class="col-12 col-lg-6 col-xl-4 my-3 text-center">
<div *ngFor="let project of getProject()" class="col-12 col-lg-6 col-xl-4 my-3 text-center">
<app-datasets-by-project
[project]="project"
[datasetList]="getDatasetsByProject(project.name)"
......
......@@ -14,9 +14,22 @@ export class DatasetListComponent {
@Output() updateSelectedDatasets: EventEmitter<string[]> = new EventEmitter();
getProjectSortedByName(): Project[] {
return [...this.projectList].sort((a, b) => a.name.localeCompare(b.name));
// Return project that contains datasets with cone search enabled
// Return projects are sorted by name
getProject(): Project[] {
const projectNames: string[] = [];
this.datasetList.forEach(d => {
if (!projectNames.includes(d.project_name)) {
projectNames.push(d.project_name);
}
});
return [...this.projectList]
.filter(p => projectNames.includes(p.name))
.sort((a, b) => a.name.localeCompare(b.name));
}
// getProjectSortedByName(): Project[] {
// return [...this.projectList].sort((a, b) => a.name.localeCompare(b.name));
// }
getDatasetsByProject(projectName: string): Dataset[] {
return this.datasetList.filter(d => d.project_name === projectName);
......
......@@ -24,6 +24,8 @@ export class SummaryMultipleComponent {
accordionProjectIsOpen = true;
// Return project that contains datasets with cone search enabled
// Return projects are sorted by name
getProject(): Project[] {
const projectNames: string[] = [];
this.datasetList.forEach(d => {
......
......@@ -42,7 +42,7 @@ export class DatasetsComponent implements OnInit {
this.datasetSearchMetaIsLoaded = store.select(metamodelSelector.getDatasetSearchMetaIsLoaded);
this.currentStep = store.select(searchMultipleSelector.getCurrentStep);
this.projectList = store.select(metamodelSelector.getProjectList);
this.datasetList = store.select(metamodelSelector.getDatasetList);
this.datasetList = store.select(metamodelSelector.getDatasetWithConeSearchList);
this.isValidConeSearch = this.store.select(coneSearchSelector.getIsValidConeSearch);
this.selectedDatasets = this.store.select(searchMultipleSelector.getSelectedDatasets);
this.noSelectedDatasets = this.store.select(searchMultipleSelector.getNoSelectedDatasets);
......
......@@ -69,8 +69,9 @@ export class SearchMultipleEffects {
switchMap(([action, state]) => {
if (state.searchMultiple.selectedDatasets.length === 0) {
const loadDatasetSearchMetaSuccessAction = action as datasetActions.LoadDatasetSearchMetaSuccessAction;
const datasetList: Dataset[] = loadDatasetSearchMetaSuccessAction.payload[1];
const selectedDatasets: string[] = datasetList.map(d => d.name);
const datasetWithConeSearchList: Dataset[] = loadDatasetSearchMetaSuccessAction.payload[1]
.filter(d => d.config.cone_search && d.config.cone_search.enabled === true);
const selectedDatasets: string[] = datasetWithConeSearchList.map(d => d.name);
return of(new searchMultipleActions.InitSelectedDatasetsAction(selectedDatasets));
} else {
return of({ type: '[No Action] ' + searchMultipleActions.INIT_SELECTED_DATASETS });
......@@ -157,7 +158,7 @@ export class SearchMultipleEffects {
return this.searchMultipleService.retrieveData(dname, query).pipe(
map((data: { datasetName: string, data: any[] }) => new searchMultipleActions.RetrieveDataSuccessAction(data)),
// TODO: Pass dname
catchError(() => of(new searchMultipleActions.RetrieveDataFailAction('toto')))
catchError(() => of(new searchMultipleActions.RetrieveDataFailAction('')))
);
})
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment