<commit_before>const OBJECT_URL_PATH = {
  server: (id) => `compute/instances/?overlay=${id}`,
  volume: (id) => `block-storage/volumes?overlay=${id}`,
  volume_snapshot: (id) => `block-storage/snapshots?overlay=${id}`,
  image: (id) => `image/ng#/os-images/available/${id}/show`,
  flavor: (id) => `compute/flavors`,
  external_network: (id) => `networking/networks/external?overlay=${id}`,
  network: (id) => `networking/networks/external?overlay=${id}`,
  router: (id) => `networking/routers?overlay=${id}`,
  port: (id) => `networking/ports#/ports/${id}/show`,
  floatingip: (id) => `networking/floating_ips`,
  security_group: (id) => `networking/security_groups/${id}`,
  loadbalancer: (id) => `loadbalancing/loadbalancers/${id}/listeners`,
  zone: (id) => `dns-service/zones/${id}`,
  share: (id) => `shared-filesystem-storage/#/shares/${id}/show`,
  share_network: (id) => `shared-filesystem-storage/#/share-networks/${id}/show`,
  security_service: (id) => `shared-filesystem-storage/#/security-services/${id}/show`,
  share_snapshot: (id) => `shared-filesystem-storage/#/snapshots/${id}/show`
}

export const projectUrl = (item) => {
  if(!item) return null
  const scope = item.payload.scope || {}
  const isProject = item.cached_object_type=='project'
  let projectLink = null
  if(isProject) {
    projectLink = `/${item.domain_id}/${item.id}/home`
  } else if(scope.domain_id && scope.project_id) {
    projectLink = `/${scope.domain_id}/${scope.project_id}/home`
  }
  return projectLink
}

export const objectUrl = (item) => {
  if(!item) return null
  if(!item.project_id) return null

  let object_type = item.cached_object_type
  if (object_type == 'snapshot') {
    if(item.payload.share_id) object_type = 'share_snapshot'
    else if(item.payload.volume_id) object_type = 'volume_snapshot'
  } else if(object_type == 'network') {
    if(item.payload["router:external"]) {
      object_type = 'external_network'
    }
  }

  const path = OBJECT_URL_PATH[object_type]
  if(!path) return null
  const scope = item.payload.scope || {}
  return(`/${scope.domain_id}/${scope.project_id}/${path(item.id)}`)
}

export const vCenterUrl = (item) => {
  if(!item) return null

  let objectType = item.cached_object_type

  if (objectType == 'server') {
    let az = item.payload['OS-EXT-AZ:availability_zone']
    if(az) {
      // parse region and zone
      let region = az.slice(0,-1)
      let zone = az.slice(-1)
      
      return (`https://vc-${zone}-0.cc.${region}.cloud.sap/vsphere-client/`)
    } else {
      return null
    }
  } else {<commit_msg>Change vsphere link to deep link to instance<commit_after>const OBJECT_URL_PATH = {
  server: (id) => `compute/instances/?overlay=${id}`,
  volume: (id) => `block-storage/volumes?overlay=${id}`,
  volume_snapshot: (id) => `block-storage/snapshots?overlay=${id}`,
  image: (id) => `image/ng#/os-images/available/${id}/show`,
  flavor: (id) => `compute/flavors`,
  external_network: (id) => `networking/networks/external?overlay=${id}`,
  network: (id) => `networking/networks/external?overlay=${id}`,
  router: (id) => `networking/routers?overlay=${id}`,
  port: (id) => `networking/ports#/ports/${id}/show`,
  floatingip: (id) => `networking/floating_ips`,
  security_group: (id) => `networking/security_groups/${id}`,
  loadbalancer: (id) => `loadbalancing/loadbalancers/${id}/listeners`,
  zone: (id) => `dns-service/zones/${id}`,
  share: (id) => `shared-filesystem-storage/#/shares/${id}/show`,
  share_network: (id) => `shared-filesystem-storage/#/share-networks/${id}/show`,
  security_service: (id) => `shared-filesystem-storage/#/security-services/${id}/show`,
  share_snapshot: (id) => `shared-filesystem-storage/#/snapshots/${id}/show`
}

export const projectUrl = (item) => {
  if(!item) return null
  const scope = item.payload.scope || {}
  const isProject = item.cached_object_type=='project'
  let projectLink = null
  if(isProject) {
    projectLink = `/${item.domain_id}/${item.id}/home`
  } else if(scope.domain_id && scope.project_id) {
    projectLink = `/${scope.domain_id}/${scope.project_id}/home`
  }
  return projectLink
}

export const objectUrl = (item) => {
  if(!item) return null
  if(!item.project_id) return null

  let object_type = item.cached_object_type
  if (object_type == 'snapshot') {
    if(item.payload.share_id) object_type = 'share_snapshot'
    else if(item.payload.volume_id) object_type = 'volume_snapshot'
  } else if(object_type == 'network') {
    if(item.payload["router:external"]) {
      object_type = 'external_network'
    }
  }

  const path = OBJECT_URL_PATH[object_type]
  if(!path) return null
  const scope = item.payload.scope || {}
  return(`/${scope.domain_id}/${scope.project_id}/${path(item.id)}`)
}

export const vCenterUrl = (item) => {
  if(!item) return null

  let objectType = item.cached_object_type

  if (objectType == 'server') {
    let az = item.payload['OS-EXT-AZ:availability_zone']

    if(az) {
      // parse region and zone
      let region = az.slice(0,-1)
      let zone = az.slice(-1)
      let serverID = item.id

      return (`https://vc-${zone}-0.cc.${region}.cloud.sap/ui/#?extensionId=vsphere.core.search.domainView&query=${serverID}&searchType=simple`)
    } else {
      return null
    }
  } else {
{'fraction_non_alphanumeric': 0.18803418803418803, 'fraction_numerical': 0.0015194681861348527, 'mean_word_length': 4.203557312252965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 43, 'https://': 2, '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': '1118227', 'n_tokens_mistral': 1834, 'n_tokens_neox': 1851, 'n_words': 312}