function* login (action) {
  const { payload: { token, userId, username, domain } } = action
  console.group('Login Verification')

  // Verify a SSO token exists
  if (!token) {
    yield put(loginFailed({
      errorCode: 'no_access',
      message: 'Login Failed', // TODO: Localize
    }))
    return
  }

  yield put(loginSuccessful({ token, userId, username, domain }))

  // Verify the API (exists and is the correct version)
  const oVirtMeta = yield callExternalAction('getOvirtApiMeta', Api.getOvirtApiMeta, action)
  const versionOk = yield checkOvirtApiVersion(oVirtMeta)
  if (!versionOk) {
    console.error('oVirt API version check failed')
    yield put(failedExternalAction({
      message: composeIncompatibleOVirtApiVersionMessage(oVirtMeta),
      shortMessage: 'oVirt API version check failed', // TODO: Localize
    }))
    return
  }
  console.groupEnd('Login Verification')

  // API checks passed.  Load user data and the initial app data
  console.group('Login Data Fetch')
  yield checkUserFilterPermissions()
  yield fetchServerConfiguredValues()
  console.log('\u2714 login checks and server config fetches are done:',
    yield select(state => pick(
      state.config.toJS(),
      [ 'administrator', 'filter', 'domain', 'user', 'userSessionTimeoutInterval', 'websocket', 'cpuTopology' ]))
  )

  yield initialLoad()
  console.groupEnd('Login Data Fetch')

  yield put(appConfigured())
  yield put(startSchedulerFixedDelay())
  yield autoConnectCheck()
  yield put(getAllEvents())
}
/**
 * Perform login checks, and if they pass, perform initial data loading
 */
Perform login checks, and if they pass, perform initial data loading
Perform login checks and if they pass perform initial data loading
function* login (action) {
  const { payload: { token, userId, username, domain } } = action
  console.group('Login Verification')
  if (!token) {
    yield put(loginFailed({
      errorCode: 'no_access',
      message: 'Login Failed', 
    }))
    return
  }
  yield put(loginSuccessful({ token, userId, username, domain }))
  const oVirtMeta = yield callExternalAction('getOvirtApiMeta', Api.getOvirtApiMeta, action)
  const versionOk = yield checkOvirtApiVersion(oVirtMeta)
  if (!versionOk) {
    console.error('oVirt API version check failed')
    yield put(failedExternalAction({
      message: composeIncompatibleOVirtApiVersionMessage(oVirtMeta),
      shortMessage: 'oVirt API version check failed', 
    }))
    return
  }
  console.groupEnd('Login Verification')
  console.group('Login Data Fetch')
  yield checkUserFilterPermissions()
  yield fetchServerConfiguredValues()
  console.log('\u2714 login checks and server config fetches are done:',
    yield select(state => pick(
      state.config.toJS(),
      [ 'administrator', 'filter', 'domain', 'user', 'userSessionTimeoutInterval', 'websocket', 'cpuTopology' ]))
  )
  yield initialLoad()
  console.groupEnd('Login Data Fetch')
  yield put(appConfigured())
  yield put(startSchedulerFixedDelay())
  yield autoConnectCheck()
  yield put(getAllEvents())
}
function * login ( action ) { const { payload : { token , userId , username , domain } } = action console . group ( 'Login Verification' ) if ( ! token ) { yield put ( loginFailed ( { errorCode : 'no_access' , message : 'Login Failed' , } ) ) return } yield put ( loginSuccessful ( { token , userId , username , domain } ) ) const oVirtMeta = yield callExternalAction ( 'getOvirtApiMeta' , Api . getOvirtApiMeta , action ) const versionOk = yield checkOvirtApiVersion ( oVirtMeta ) if ( ! versionOk ) { console . error ( 'oVirt API version check failed' ) yield put ( failedExternalAction ( { message : composeIncompatibleOVirtApiVersionMessage ( oVirtMeta ) , shortMessage : 'oVirt API version check failed' , } ) ) return } console . groupEnd ( 'Login Verification' ) console . group ( 'Login Data Fetch' ) yield checkUserFilterPermissions ( ) yield fetchServerConfiguredValues ( ) console . log ( '\u2714 login checks and server config fetches are done:' , yield select ( state => pick ( state . config . toJS ( ) , [ 'administrator' , 'filter' , 'domain' , 'user' , 'userSessionTimeoutInterval' , 'websocket' , 'cpuTopology' ] ) ) ) yield initialLoad ( ) console . groupEnd ( 'Login Data Fetch' ) yield put ( appConfigured ( ) ) yield put ( startSchedulerFixedDelay ( ) ) yield autoConnectCheck ( ) yield put ( getAllEvents ( ) ) }
Perform login checks, and if they pass, perform initial data loading
Perform login checks and if they pass perform initial data loading
// Verify a SSO token exists // TODO: Localize // Verify the API (exists and is the correct version) // TODO: Localize // API checks passed.  Load user data and the initial app data