Newer
Older
import * as actions from './search-multiple.action';
import { Attribute } from "../../metamodel/model";
import { DatasetCount, SearchMultipleQueryParams } from "./model";
currentStep: string;
positionStepChecked: boolean;
datasetsStepChecked: boolean;
resultStepChecked: boolean;
queryParams: SearchMultipleQueryParams;
datasetsCountIsLoading: boolean;
datasetsCountIsLoaded: boolean;
datasetsCount: DatasetCount[];
attributeListIsLoading: boolean;
attributeListIsLoaded: boolean;
attributeList: Attribute[];
currentStep: null,
positionStepChecked: false,
datasetsStepChecked: false,
resultStepChecked: false,
queryParams: null,
selectedDatasets: [],
datasetsCountIsLoading: false,
datasetsCountIsLoaded: false,
datasetsCount: [],
attributeListIsLoading: false,
attributeListIsLoaded: false,
attributeList: []
};
export function reducer(state: State = initialState, action: actions.Actions): State {
switch (action.type) {
case actions.INIT_SELECTED_DATASETS:
return {
...state,
case actions.CHANGE_STEP:
return {
...state,
};
case actions.POSITION_CHECKED:
return {
...state,
positionStepChecked: true
};
case actions.DATASETS_CHECKED:
return {
...state,
datasetsStepChecked: true
};
case actions.RETRIEVE_DATASETS_COUNT:
return {
...state,
datasetsCountIsLoading: true
};
case actions.RETRIEVE_DATASETS_COUNT_SUCCESS:
return {
...state,
datasetsCountIsLoading: false,
datasetsCountIsLoaded: true,
datasetsCount: action.payload
};
case actions.RETRIEVE_DATASETS_COUNT_FAIL:
return {
...state,
datasetsCountIsLoading: false
};
case actions.RETRIEVE_ATTRIBUTE_LIST:
return {
...state,
attributeListIsLoading: true
};
case actions.RETRIEVE_ATTRIBUTE_LIST_SUCCESS:
return {
...state,
attributeListIsLoading: false,
attributeListIsLoaded: true,
attributeList: action.payload
};
case actions.RETRIEVE_ATTRIBUTE_LIST_FAIL:
return {
...state,
attributeListIsLoading: false
};
case actions.DESTROY_RESULTS:
return {
...state,
datasetsCountIsLoaded: false,
datasetsCount: []
};
export const getCurrentStep = (state: State) => state.currentStep;
export const getPositionStepChecked = (state: State) => state.positionStepChecked;
export const getDatasetsStepChecked = (state: State) => state.datasetsStepChecked;
export const getResultStepChecked = (state: State) => state.resultStepChecked;
export const getQueryParams = (state: State) => state.queryParams;
export const getSelectedDatasets = (state: State) => state.selectedDatasets;
export const getDatasetsCountIsLoading = (state: State) => state.datasetsCountIsLoading;
export const getDatasetsCountIsLoaded = (state: State) => state.datasetsCountIsLoaded;
export const getDatasetsCount = (state: State) => state.datasetsCount;
export const getAttributeList = (state: State) => state.attributeList;