function StorageId()

in frontend/src/old-pages/Clusters/Filesystems.tsx [36:94]


function StorageId({storage}: any) {
  const {t} = useTranslation()
  const settingsKey = `${storage.StorageType}Settings`
  const canMountFileSystem = ['Efs', 'FsxLustre'].includes(storage.StorageType)
  const idKey = canMountFileSystem ? 'FileSystemId' : 'VolumeId'
  const detailsFragment = canMountFileSystem
    ? '#file-system-details'
    : '#volume-details'
  const id = getIn(storage, [settingsKey, idKey])
  const defaultRegion = useState(['aws', 'region'])
  const region = useState(['app', 'selectedRegion']) || defaultRegion
  const isFsxOnTapActive = useFeatureFlag('fsx_ontap')
  const isFsxOpenZsfActive = useFeatureFlag('fsx_openzsf')
  const fsxStorageTypes = [
    'FsxLustre',
    isFsxOnTapActive ? 'FsxOntap' : false,
    isFsxOpenZsfActive ? 'FsxOpenZfs' : false,
  ].filter(Boolean)

  if (!id) return 'internal'

  return (
    <>
      {fsxStorageTypes.includes(storage.StorageType) && (
        <Link
          external
          externalIconAriaLabel={t('global.openNewTab')}
          href={`${consoleDomain(
            region,
          )}/fsx/home?region=${region}${detailsFragment}/${id}`}
        >
          {id}
        </Link>
      )}
      {storage.StorageType === 'Efs' && (
        <Link
          external
          externalIconAriaLabel={t('global.openNewTab')}
          href={`${consoleDomain(
            region,
          )}/efs/home?region=${region}#/file-systems/${id}`}
        >
          {id}
        </Link>
      )}
      {storage.StorageType === 'Ebs' && (
        <Link
          external
          externalIconAriaLabel={t('global.openNewTab')}
          href={`${consoleDomain(
            region,
          )}/ec2/v2/home?region=${region}#VolumeDetails:volumeId=${id}`}
        >
          {id}
        </Link>
      )}
    </>
  )
}