text: import React, { Fragment } from 'react';
  import PropType from 'prop-types';
  import { Tooltip } from '@patternfly/react-core';
  import { FormattedMessage } from 'react-intl';
  import { PATCHMAN_ADVISORY_PATH, CUSTOMER_PORTAL_ADVISORY_PATH } from '../../../Helpers/constants';
  import messages from '../../../Messages';
  import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons';
  import { createRHDBLink } from '../../../Helpers/CVEHelper';
  import { useParams } from 'react-router-dom';
  
  const AdvisoryColumn = ({ cve, advisoriesList, linkAdvisoriesToCustomerPortal }) => {
      let { cve: cveName } = useParams();
  
      return (
          advisoriesList?.length > 0
              ? (
                  advisoriesList.map((advisory, _i) =>
                      <a
                          key={_i}
                          href={linkAdvisoriesToCustomerPortal
                              ? `${CUSTOMER_PORTAL_ADVISORY_PATH}/${advisory}`
                              : `${PATCHMAN_ADVISORY_PATH}/${advisory}`
                          }
                          target="_blank"
                          rel="noopener noreferrer"
                      >
                          {advisory}
                      </a>
                  ).reduce((prev, curr, index) => [prev, ', ', <br key={index}/>, curr])
              ) : (
                  <Fragment>
                      <FormattedMessage {...messages.notAvailable} />
                      <Tooltip exitDelay={2000} appendTo={document.querySelector('.vulnerability')} content={
                          <FormattedMessage
                              {...messages.advisoryTooltip}
                              values={
                                  {
                                      link: createRHDBLink(
                                          cve ?? cveName,
                                          messages.rhCVEdb,
                                          { className: 'toolip-link--embeded' }
                                      )
                                  }
                              }
                          />
                      }>
                          <OutlinedQuestionCircleIcon
                              className="pf-u-ml-xs"
                              color="var(--pf-global--Color--200)"
                          />
                      </Tooltip>
                  </Fragment>
              )
      );
  };
  
  AdvisoryColumn.propTypes = {
      advisoriesList: PropType.array,
      cve: PropType.string,
      linkAdvisoriesToCustomerPortal: PropType.bool
  };
  
  export default AdvisoryColumn;
  