<commit_before>import _, { messages } from 'messages'
import ActionButton from 'action-button'
import filter from 'lodash/filter'
import Icon from 'icon'
import includes from 'lodash/includes'
import info, { error } from 'notification'
import isEmpty from 'lodash/isEmpty'
import map from 'lodash/map'
import React, { Component } from 'react'
import trim from 'lodash/trim'
import Wizard, { Section } from 'wizard'
import { confirm } from 'modal'
import { connectStore, formatSize } from 'utils'
import { createGetObjectsOfType, createFilter, createSelector } from 'selectors'
import { GenericSelect, SelectHost } from 'select-objects'
import { injectIntl } from 'react-intl'
import { Password } from 'form'

class SelectIqn extends GenericSelect {
  _computeOptions (props) {
    return map(props.options, iqn => ({
      value: iqn,
      label: `${iqn.iqn} (${iqn.ip})`
    }))
  }
  get value () {
    const value = this.state.value
    return value && value.value || value
  }
}

class SelectLun extends GenericSelect {
  _computeOptions (props) {
    return map(props.options, lun => ({
      value: lun,
      label: `LUN ${lun.id}: ${lun.serial} - ${formatSize(+lun.size)} - (${lun.vendor})`
    }))
  }
  get value () {
    const value = this.state.value
    return value && value.value || value
  }
}

import {
  createSrIso,
  createSrIscsi,
  createSrLvm,
  createSrNfs,
  probeSrIscsiExists,
  probeSrIscsiIqns,
  probeSrIscsiLuns,
  probeSrNfs,
  probeSrNfsExists,
  reattachSrIso,
  reattachSr
} from 'xo'

// ===================================================================

const SR_TYPE_TO_LABEL = {
  nfs: 'NFS',
  iscsi: 'iSCSI',
  lvm: 'Local LVM',
  local: 'Local',
  nfsiso: 'NFS ISO',
  smb: 'SMB'
}

const SR_GROUP_TO_LABEL = {
  vdisr: 'VDI SR',
  isosr: 'ISO SR'
}

const typeGroups = {
  vdisr: ['nfs', 'iscsi', 'lvm'],
  isosr: ['local', 'nfsiso', 'smb']
}

const getSrPath = id => `/sr/${id}`

// ===================================================================

@injectIntl
@connectStore(() => ({
  hosts: createGetObjectsOfType('host'),
  srs: createGetObjectsOfType('SR')
}))
export default class New extends Component {
  constructor (props) {
    super(props)
    this.state = {
      description: undefined,
      host: undefined,
      iqn: undefined,
      iqns: undefined,
      lockCreation: undefined,
      lun: undefined,<commit_msg>fix(new sr): wrong URL for srs view<commit_after>import _, { messages } from 'messages'
import ActionButton from 'action-button'
import filter from 'lodash/filter'
import Icon from 'icon'
import includes from 'lodash/includes'
import info, { error } from 'notification'
import isEmpty from 'lodash/isEmpty'
import map from 'lodash/map'
import React, { Component } from 'react'
import trim from 'lodash/trim'
import Wizard, { Section } from 'wizard'
import { confirm } from 'modal'
import { connectStore, formatSize } from 'utils'
import { createGetObjectsOfType, createFilter, createSelector } from 'selectors'
import { GenericSelect, SelectHost } from 'select-objects'
import { injectIntl } from 'react-intl'
import { Password } from 'form'

class SelectIqn extends GenericSelect {
  _computeOptions (props) {
    return map(props.options, iqn => ({
      value: iqn,
      label: `${iqn.iqn} (${iqn.ip})`
    }))
  }
  get value () {
    const value = this.state.value
    return value && value.value || value
  }
}

class SelectLun extends GenericSelect {
  _computeOptions (props) {
    return map(props.options, lun => ({
      value: lun,
      label: `LUN ${lun.id}: ${lun.serial} - ${formatSize(+lun.size)} - (${lun.vendor})`
    }))
  }
  get value () {
    const value = this.state.value
    return value && value.value || value
  }
}

import {
  createSrIso,
  createSrIscsi,
  createSrLvm,
  createSrNfs,
  probeSrIscsiExists,
  probeSrIscsiIqns,
  probeSrIscsiLuns,
  probeSrNfs,
  probeSrNfsExists,
  reattachSrIso,
  reattachSr
} from 'xo'

// ===================================================================

const SR_TYPE_TO_LABEL = {
  nfs: 'NFS',
  iscsi: 'iSCSI',
  lvm: 'Local LVM',
  local: 'Local',
  nfsiso: 'NFS ISO',
  smb: 'SMB'
}

const SR_GROUP_TO_LABEL = {
  vdisr: 'VDI SR',
  isosr: 'ISO SR'
}

const typeGroups = {
  vdisr: ['nfs', 'iscsi', 'lvm'],
  isosr: ['local', 'nfsiso', 'smb']
}

const getSrPath = id => `/srs/${id}`

// ===================================================================

@injectIntl
@connectStore(() => ({
  hosts: createGetObjectsOfType('host'),
  srs: createGetObjectsOfType('SR')
}))
export default class New extends Component {
  constructor (props) {
    super(props)
    this.state = {
      description: undefined,
      host: undefined,
      iqn: undefined,
      iqns: undefined,
      lockCreation: undefined,
      lun: undefined,
{'fraction_non_alphanumeric': 0.18487570503446835, 'fraction_numerical': 0.0, 'mean_word_length': 3.9411764705882355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6481607', 'n_tokens_mistral': 1659, 'n_tokens_neox': 1599, 'n_words': 413}