Newer
Older
criteriaStepChecked: boolean;
outputStepChecked: boolean;
resultStepChecked: boolean;
searchMetaIsLoading: boolean;
searchMetaIsLoaded: boolean;
criteriaStepChecked: false,
outputStepChecked: false,
resultStepChecked: false,
searchMetaIsLoading: false,
searchMetaIsLoaded: false,
};
export function reducer(state: State = initialState, action: actions.Actions): State {
switch (action.type) {
case actions.CHANGE_STEP:
const currentStep = action.payload as string;
return {
...state,
currentStep
};
case actions.SELECT_DATASET:
const datasetName = action.payload as string;
return {
...state,
return {
...initialState,
currentStep: 'dataset'
};
case actions.CRITERIA_CHECKED:
return {
...state,
criteriaStepChecked: true
};
case actions.OUTPUT_CHECKED:
return {
...state,
outputStepChecked: true
};
case actions.RESULT_CHECKED:
return {
...state,
resultStepChecked: true
};
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
case actions.UPDATE_CRITERIA_LIST:
const criteriaList = action.payload as Criterion[];
return {
...state,
criteriaList
};
case actions.ADD_CRITERION:
const criterion = action.payload as Criterion;
return {
...state,
criteriaList: [...state.criteriaList, criterion]
};
case actions.DELETE_CRITERION:
const id = action.payload as number;
return {
...state,
criteriaList: [...state.criteriaList.filter(c => c.id !== id)]
};
case actions.UPDATE_OUTPUT_LIST:
const outputList = action.payload as number[];
return {
...state,
outputList
};
case actions.RETRIEVE_META:
return {
...state,
searchMetaIsLoading: true
};
case actions.RETRIEVE_META_SUCCESS:
const searchMeta = action.payload as SearchMeta;
return {
...state,
searchMeta,
searchMetaIsLoading: false,
searchMetaIsLoaded: true
};
case actions.RETRIEVE_META_FAIL:
return {
...state,
searchMeta,
searchMetaIsLoading: false,
searchMetaIsLoaded: false
case actions.RETRIEVE_DATA_SUCCESS:
const searchData = action.payload as any[];
return {
...state,
searchData
export const getPristine = (state: State) => state.pristine;
export const getCurrentStep = (state: State) => state.currentStep;
export const getDatasetName = (state: State) => state.datasetName;
export const getCriteriaStepChecked = (state: State) => state.criteriaStepChecked;
export const getOutputStepChecked = (state: State) => state.outputStepChecked;
export const getResultStepChecked = (state: State) => state.resultStepChecked;
export const getCriteriaList = (state: State) => state.criteriaList;
export const getOutputList = (state: State) => state.outputList;
export const getSearchMetaIsLoading = (state: State) => state.searchMetaIsLoading;
export const getSearchMetaIsLoaded = (state: State) => state.searchMetaIsLoaded;
export const getSearchMeta = (state: State) => state.searchMeta;
export const getSearchData = (state: State) => state.searchData;