<commit_before>import {
  takeEvery,
  put,
  select,
  call,
} from 'redux-saga/effects'

import Api from '_/ovirtapi'
import OptionsManager from '_/optionsManager'
import { fileDownload, toJS } from '_/helpers'
import { doesVmSessionExistForUserId, idFromType } from '_/utils'
import * as Actions from '_/actions'

import { callExternalAction } from '../utils'
import {
  fetchVmSessions,
  fetchAndPutSingleVm,
} from '../index'

import { adjustVVFile } from './vvFileUtils'
import RDPBuilder from './rdpBuilder'

import { push } from 'connected-react-router'
import * as C from '_/constants'
import { canConsole, statusToTooltipId } from '_/vm-status'
import { getConsoles } from '_/utils/console'

// ----- Connection files
/**
 * Push a virt-viewer connection file (__console.vv__) to connect a user to a VM's console
 */
function* downloadOrOpenVmConsole ({
  vmName,
  consoleType,
  vmId,
  consoleId,
  usbAutoshare,
  usbFilter,
  hasGuestAgent,
  skipSSO,
  openInPage,
  logoutOtherUsers,
}) {
  if (hasGuestAgent && !skipSSO) {
    const result = yield callExternalAction(Api.vmLogon, { payload: { vmId } }, true)
    if (!result || result.status !== 'complete') {
      yield put(Actions.addUserMessage({ messageDescriptor: { id: 'cantLogonToConsole' }, type: 'warning' }))
    }
  }

  yield put(Actions.dismissConsoleError({ vmId, consoleType }))

  let data = yield callExternalAction(Api.console, { type: 'INTERNAL_CONSOLE', payload: { vmId, consoleId } })
  if (data.error) {
    return
  }

  const isSpice = consoleType === C.SPICE
  if (consoleType === C.NATIVE_VNC || isSpice) {<commit_msg>Show notification with server-side SSO error<commit_after>import {
  takeEvery,
  put,
  select,
  call,
} from 'redux-saga/effects'

import Api from '_/ovirtapi'
import OptionsManager from '_/optionsManager'
import { fileDownload, toJS } from '_/helpers'
import { doesVmSessionExistForUserId, idFromType } from '_/utils'
import * as Actions from '_/actions'

import { callExternalAction } from '../utils'
import {
  fetchVmSessions,
  fetchAndPutSingleVm,
} from '../index'

import { adjustVVFile } from './vvFileUtils'
import RDPBuilder from './rdpBuilder'

import { push } from 'connected-react-router'
import * as C from '_/constants'
import { canConsole, statusToTooltipId } from '_/vm-status'
import { getConsoles } from '_/utils/console'

// ----- Connection files
/**
 * Push a virt-viewer connection file (__console.vv__) to connect a user to a VM's console
 */
function* downloadOrOpenVmConsole ({
  vmName,
  consoleType,
  vmId,
  consoleId,
  usbAutoshare,
  usbFilter,
  hasGuestAgent,
  skipSSO,
  openInPage,
  logoutOtherUsers,
}) {
  if (hasGuestAgent && !skipSSO) {
    const result = yield callExternalAction(Api.vmLogon, { payload: { vmId } }, true)
    if (!result || result.status !== 'complete') {
      const message = result?.error?.responseJSON?.fault?.detail ?? ''
      if (message) {
        yield put(Actions.addUserMessage({ messageDescriptor: { id: 'cantOpenConsole', params: { message } }, type: 'warning' }))
      }
      yield put(Actions.addUserMessage({ messageDescriptor: { id: 'cantLogonToConsole' }, type: 'warning' }))
    }
  }

  yield put(Actions.dismissConsoleError({ vmId, consoleType }))

  let data = yield callExternalAction(Api.console, { type: 'INTERNAL_CONSOLE', payload: { vmId, consoleId } })
  if (data.error) {
    return
  }

  const isSpice = consoleType === C.SPICE
  if (consoleType === C.NATIVE_VNC || isSpice) {
{'fraction_non_alphanumeric': 0.13040985955861278, 'fraction_numerical': 0.0, 'mean_word_length': 4.028818443804035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5739663', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1127, 'n_words': 295}