Commit 44d5ee6e authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

All datasets selected or not from config => DONE

parent c87cbf5d
......@@ -6,7 +6,10 @@ export interface Instance {
nb_datasets: number;
config: {
search: boolean;
search_multiple: boolean;
search_multiple: {
allowed: boolean;
all_datasets_selected: boolean;
};
documentation: boolean;
};
}
......@@ -62,22 +62,23 @@ export class SearchMultipleEffects {
})
);
// @Effect()
// loadDatasetSearchMetaSuccessAction$ = this.actions$.pipe(
// ofType(datasetActions.LOAD_DATASET_SEARCH_META_SUCCESS),
// withLatestFrom(this.store$),
// switchMap(([action, state]) => {
// if (state.searchMultiple.selectedDatasets.length === 0) {
// const loadDatasetSearchMetaSuccessAction = action as datasetActions.LoadDatasetSearchMetaSuccessAction;
// 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 });
// }
// })
// );
@Effect()
loadDatasetSearchMetaSuccessAction$ = this.actions$.pipe(
ofType(datasetActions.LOAD_DATASET_SEARCH_META_SUCCESS),
withLatestFrom(this.store$),
switchMap(([action, state]) => {
const allDatasetsSelected = state.metamodel.instance.instance.config.search_multiple.all_datasets_selected;
if (allDatasetsSelected && state.searchMultiple.selectedDatasets.length === 0) {
const loadDatasetSearchMetaSuccessAction = action as datasetActions.LoadDatasetSearchMetaSuccessAction;
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 });
}
})
);
@Effect()
retrieveDatasetsCountAction$ = this.actions$.pipe(
......
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