2 * Copyright © 2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http: //www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 import { call, put, takeLatest, throttle } from 'redux-saga/effects';
19 import catalogApi from 'features/catalog/catalogApi';
20 import { fetchWorkflow, updateWorkflow } from 'features/catalog/catalogActions';
24 } from 'features/catalog/catalogConstants';
26 const noOp = () => {};
28 export function* fetchWorkflowSaga({ payload }) {
29 const { sort, limit, offset, searchNameFilter } = payload;
31 const data = yield call(
32 catalogApi.getWorkflows,
35 offset === undefined ? 0 : offset + limit,
38 yield put(updateWorkflow({ sort, ...data }));
44 function* catalogSaga() {
45 yield takeLatest(fetchWorkflow, fetchWorkflowSaga);
46 yield throttle(SEARCH_BUFFER, SEARCH_CHANGED, fetchWorkflowSaga);
49 export default catalogSaga;