function clusterValidate()

in frontend/src/old-pages/Configure/Cluster.tsx [69:129]


function clusterValidate() {
  const vpc = getState(['app', 'wizard', 'vpc'])
  const region = getState(['app', 'wizard', 'config', 'Region'])
  const editing = getState(['app', 'wizard', 'editing'])
  const customAmiEnabled = getState(['app', 'wizard', 'customAMI', 'enabled'])
  const customAmi = getState(['app', 'wizard', 'config', 'Image', 'CustomAmi'])
  const multiUserEnabled = getState(['app', 'wizard', 'multiUser']) || false
  let valid = true

  setState([...errorsPath, 'validated'], true)

  if (!editing && !vpc) {
    setState(
      [...errorsPath, 'vpc'],
      i18next.t('wizard.cluster.validation.VpcSelect'),
    )
    valid = false
  } else {
    clearState([...errorsPath, 'vpc'])
  }

  if (!region) {
    setState(
      [...errorsPath, 'region'],
      i18next.t('wizard.cluster.validation.regionSelect'),
    )
    valid = false
  } else {
    clearState([...errorsPath, 'region'])
  }

  if (customAmiEnabled && !customAmi) {
    setState(
      [...errorsPath, 'customAmi'],
      i18next.t('wizard.cluster.validation.customAmiSelect'),
    )
    valid = false
  } else {
    clearState([...errorsPath, 'customAmi'])
  }

  if (multiUserEnabled && !multiUserValidate()) {
    valid = false
  } else {
    clearState([...errorsPath, 'multiUser'])
  }

  if (!editing) {
    const clusterNameValid = validateClusterNameAndSetErrors()
    if (!clusterNameValid) {
      valid = false
    }
  }

  const accountingValid = slurmAccountingValidateAndSetErrors()
  if (!accountingValid) {
    valid = false
  }

  return valid
}