function * watchToggle({globalRegistry}) { const nodeTypesRegistry = globalRegistry.get('@neos-project/neos-ui-contentrepository'); yield * takeLatest(actionTypes.UI.PageTree.TOGGLE, function * toggleTreeNode(action) { const state = yield select(); const {contextPath} = action.payload; const childrenAreFullyLoaded = $get(['cr', 'nodes', 'byContextPath', contextPath, 'children'], state).toJS() .filter(childEnvelope => nodeTypesRegistry.hasRole(childEnvelope.nodeType, 'document')) .every( childEnvelope => Boolean($get(['cr', 'nodes', 'byContextPath', $get('contextPath', childEnvelope)], state)) ); if (!childrenAreFullyLoaded) { yield put(actions.UI.PageTree.requestChildren(contextPath)); } }); }
function* watchAdd() { yield takeLatest('topics/add', function *(action){ try { const result = yield call(add, action.payload.params) if (action.payload.resolve) { action.payload.resolve({ ...action.payload.params, id: result.identity }) } } catch (error) { if (action.payload.reject) { action.payload.reject(error) } } }) }
function* watchList() { yield takeLatest('lessonteam/list', function *(action) { try { const { list } = yield call(getLessonTeamList, action.payload.params) /** * 1.传lesson_id返回团队成员、 * 2.传account_id返回对应的课程列表 */ if (list && list.length > 0) { if (action.payload.params.lesson_id > 0) { const users = yield call(getUserList, { id_list : list.map(i => i.account_id) }) if (action.payload.resolve) { action.payload.resolve(users.list.map(item => { const temp = list.find(i => i.account_id === item.id) if (temp){ item.tid = temp.id item.role = temp.role return item } return item })) } } else { const lessons = yield call(listLesson, { id_list: list.map(i => i.lesson_id) }) if (action.payload.resolve) { action.payload.resolve(lessons.list) } } } else { if (action.payload.resolve) { action.payload.resolve([]) } } } catch (error) { if (action.payload.reject) { action.payload.reject(error) } } }) }
function* watchRemove() { yield takeLatest('lesson_team/delete', function *(action) { try { //如果没有id则先getid再删除 if (!action.payload.params.id) { const result = yield call(getLessonTeam, action.payload.params) yield call(deleteLessonTeam, { id: result.get.id }) } else { yield call(deleteLessonTeam, action.payload.params) } if (action.payload.resolve) { action.payload.resolve() } } catch (error) { if (action.payload.reject) { action.payload.reject(error) } } }) }
function* watchEdit() { yield takeLatest('topics/edit', function* (action) { try { yield call(edit, action.payload.params) if (action.payload.resolve) { action.payload.resolve() } yield put({ type: 'topics/edit/success', payload: action.payload.params }) } catch (error) { if (action.payload.reject) { action.payload.reject(error) } yield put({ type: 'topics/edit/failure' }) } }) }
function * watchCurrentDocument({configuration}) { yield * takeLatest(actionTypes.UI.ContentCanvas.SET_CONTEXT_PATH, function * loadDocumentRootLine(action) { const {contextPath} = action.payload; const siteNodeContextPath = yield select($get('cr.nodes.siteNode')); const {q} = backend.get(); let parentContextPath = contextPath; const siteNode = yield select(selectors.CR.Nodes.siteNodeSelector); const loadingDepth = configuration.nodeTree.loadingDepth; while (parentContextPath !== siteNodeContextPath) { parentContextPath = parentNodeContextPath(parentContextPath); const getNodeByContextPathSelector = selectors.CR.Nodes.makeGetNodeByContextPathSelector(parentContextPath); let node = yield select(getNodeByContextPathSelector); // If the given node is not in the state, load it if (!node) { yield put(actions.UI.PageTree.setAsLoading(siteNodeContextPath)); const nodes = yield q(parentContextPath).get(); yield put(actions.CR.Nodes.add(nodes.reduce((nodeMap, node) => { nodeMap[$get('contextPath', node)] = node; return nodeMap; }, {}))); node = yield select(getNodeByContextPathSelector); } // Calculate if the given node is collapsed, and if so the uncollapse it const isToggled = yield select($contains(parentContextPath, 'ui.pageTree.toggled')); const isCollapsed = isNodeCollapsed(node, isToggled, siteNode, loadingDepth); if (isCollapsed) { yield put(actions.UI.PageTree.toggle(parentContextPath)); } } yield put(actions.UI.PageTree.focus(contextPath)); yield put(actions.UI.PageTree.setAsLoaded(siteNodeContextPath)); }); }
export default function * removeNodeIfConfirmed() { yield * takeLatest(actionTypes.CR.Nodes.COMMENCE_REMOVAL, function * waitForConfirmation() { const state = yield select(); const waitForNextAction = yield race([ take(actionTypes.CR.Nodes.REMOVAL_ABORTED), take(actionTypes.CR.Nodes.REMOVAL_CONFIRMED) ]); const nextAction = Object.values(waitForNextAction)[0]; if (nextAction.type === actionTypes.CR.Nodes.REMOVAL_ABORTED) { return; } if (nextAction.type === actionTypes.CR.Nodes.REMOVAL_CONFIRMED) { const nodeToBeRemovedContextPath = $get('cr.nodes.toBeRemoved', state); yield put(actions.Changes.persistChanges([{ type: 'Neos.Neos.Ui:RemoveNode', subject: nodeToBeRemovedContextPath }])); } }); }
export function* selectTopicSaga() { yield* takeLatest(SELECT_TOPIC, pushTopic); }
export function* fetchTopicSaga() { yield* takeLatest(REQUEST_TOPICS, fetchTopics); }
function* watchNew() { yield * takeLatest('lesson/new', handleNew) }
return function*() { yield takeLatest(k, sagaWithErrorCatch); };
function* loginErrorWatch() { yield* takeLatest('user/LOGIN_ERROR', loginError); }
function* saveLoginWatch() { yield* takeLatest('user/SAVE_LOGIN', saveLogin_localStorage); }
function* sagaOfSaga(): Generator<IOEffect,*,*> { yield* takeLatest('Foo', saga0); }
function* watchNetworksFetch() { yield* takeLatest('NETWORKS_FETCH_REQUESTED', networksFetch); }
function* lookupPreviousOwnerAuthorityWatch() { yield* takeLatest('user/lookupPreviousOwnerAuthority', lookupPreviousOwnerAuthority); }
function* loginWatch() { yield* takeLatest('user/USERNAME_PASSWORD_LOGIN', usernamePasswordLogin); }
export function* watchUserLogin() { yield* takeLatest('user/SET_USER', fetchOpenOrders); }
function* logoutWatch() { yield* takeLatest('user/LOGOUT', logout); }
export function* watchLocationChange() { yield* takeLatest('@@router/LOCATION_CHANGE', fetchMarket); }
export function* watchRemoveHighSecurityKeys() { yield* takeLatest('@@router/LOCATION_CHANGE', removeHighSecurityKeys); }
export function* watchMarketUpdate() { yield* takeLatest('market/UPDATE_MARKET', reloadMarket); }
function* watchEdit() { yield * takeLatest('lesson/edit', handleEdit) }
export const reduxStorageLoadSaga = function* reduxStorageLoadSaga() { yield* takeLatest(REDUX_STORAGE_LOAD, userUpdateToken); };
function* watchList() { yield * takeLatest('lesson/list', handleList) }
function* processEvents() { yield* takeLatest(FETCH_PROCESSING, waitForResults) }
export function* selectDefaultTopicSaga() { yield* takeLatest(REQUEST_TOPICS_SUCCESS, selectDefaultTopic); }
export function* watchInitializeAppState() { yield* takeLatest(APP_LOADING_STARTED, initializeAppState); }
export default function* rootSaga() { yield * takeLatest("FETCH_CAMPERS_START", fetchLeaderboard); }
export default function* () { yield [ takeEvery(LOAD_SKILLS, doLoadSkills), takeLatest(PASS_SEARCH_SKILLS, throttleSearch) ]; }