Exemplo n.º 1
0
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));
        }
    });
}
Exemplo n.º 2
0
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)
      }
    }
  })
}
Exemplo n.º 3
0
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)
      }
    }
  })
}
Exemplo n.º 4
0
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)
      }
    }
  })
}
Exemplo n.º 5
0
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'
      })
    }
  })
}
Exemplo n.º 6
0
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));
    });
}
Exemplo n.º 7
0
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
            }]));
        }
    });
}
Exemplo n.º 8
0
export function* selectTopicSaga() {
  yield* takeLatest(SELECT_TOPIC, pushTopic);
}
Exemplo n.º 9
0
export function* fetchTopicSaga() {
  yield* takeLatest(REQUEST_TOPICS, fetchTopics);
}
Exemplo n.º 10
0
function* watchNew() {
    yield * takeLatest('lesson/new', handleNew)
}
Exemplo n.º 11
0
Arquivo: index.js Projeto: SimplyY/dva
 return function*() {
   yield takeLatest(k, sagaWithErrorCatch);
 };
Exemplo n.º 12
0
function* loginErrorWatch() {
    yield* takeLatest('user/LOGIN_ERROR', loginError);
}
Exemplo n.º 13
0
function* saveLoginWatch() {
    yield* takeLatest('user/SAVE_LOGIN', saveLogin_localStorage);
}
Exemplo n.º 14
0
 function* sagaOfSaga(): Generator<IOEffect,*,*> {
   yield* takeLatest('Foo', saga0);
 }
Exemplo n.º 15
0
function* watchNetworksFetch() {
  yield* takeLatest('NETWORKS_FETCH_REQUESTED', networksFetch);
}
Exemplo n.º 16
0
function* lookupPreviousOwnerAuthorityWatch() {
    yield* takeLatest('user/lookupPreviousOwnerAuthority', lookupPreviousOwnerAuthority);
}
Exemplo n.º 17
0
function* loginWatch() {
    yield* takeLatest('user/USERNAME_PASSWORD_LOGIN', usernamePasswordLogin);
}
Exemplo n.º 18
0
export function* watchUserLogin() {
    yield* takeLatest('user/SET_USER', fetchOpenOrders);
}
Exemplo n.º 19
0
function* logoutWatch() {
    yield* takeLatest('user/LOGOUT', logout);
}
Exemplo n.º 20
0
export function* watchLocationChange() {
    yield* takeLatest('@@router/LOCATION_CHANGE', fetchMarket);
}
Exemplo n.º 21
0
export function* watchRemoveHighSecurityKeys() {
    yield* takeLatest('@@router/LOCATION_CHANGE', removeHighSecurityKeys);
}
Exemplo n.º 22
0
export function* watchMarketUpdate() {
    yield* takeLatest('market/UPDATE_MARKET', reloadMarket);
}
Exemplo n.º 23
0
function* watchEdit() {
    yield * takeLatest('lesson/edit', handleEdit)
}
Exemplo n.º 24
0
export const reduxStorageLoadSaga = function* reduxStorageLoadSaga() {
  yield* takeLatest(REDUX_STORAGE_LOAD, userUpdateToken);
};
Exemplo n.º 25
0
function* watchList() {
    yield * takeLatest('lesson/list', handleList)
}
Exemplo n.º 26
0
function* processEvents() {
  yield* takeLatest(FETCH_PROCESSING, waitForResults)
}
Exemplo n.º 27
0
export function* selectDefaultTopicSaga() {
  yield* takeLatest(REQUEST_TOPICS_SUCCESS, selectDefaultTopic);
}
Exemplo n.º 28
0
export function* watchInitializeAppState() {
  yield* takeLatest(APP_LOADING_STARTED, initializeAppState);
}
Exemplo n.º 29
0
export default function* rootSaga() {
	yield * takeLatest("FETCH_CAMPERS_START", fetchLeaderboard);
}
Exemplo n.º 30
0
export default function* () {
	yield [
		takeEvery(LOAD_SKILLS, doLoadSkills),
		takeLatest(PASS_SEARCH_SKILLS, throttleSearch)
	];
}