<commit_before>import * as React from 'react';

import { isNil, isEmpty } from 'ramda';

import { Avatar, Tooltip } from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';

import { IconButton } from '@centreon/ui';

import IconColumn from '../IconColumn';

const useStyles = makeStyles((theme) => ({
  avatar: {
    backgroundColor: theme.palette.primary.main,
    fontSize: theme.typography.body2.fontSize,
    height: theme.spacing(2),
    width: theme.spacing(2),
  },
}));

interface Props {
  avatarTitle?: string;
  endpoint?: string;
  icon: JSX.Element;
  title?: string;
}

const UrlColumn = ({
  endpoint,
  title,
  icon,
  avatarTitle,
}: Props): JSX.Element | null => {
  const classes = useStyles();

  const isEndpointEmpty = isNil(endpoint) || isEmpty(endpoint);
  const isTitleEmpty = isNil(title) || isEmpty(title);

  if (isEndpointEmpty && isTitleEmpty) {
    return null;
  }

  if (isEndpointEmpty) {
    return (
      <IconColumn>
        <Tooltip className={classes.avatar} title={title as string}>
          <Avatar>{avatarTitle}</Avatar>
        </Tooltip>
      </IconColumn>
    );
  }

  return (
    <IconColumn>
      <a
        href={endpoint}
        onClick={(e): void => {
          e.stopPropagation();
        }}
      >
        <IconButton
          ariaLabel={title}
          size="large"
          title={title || endpoint}
          onClick={(): null => {
            return null;
          }}
        >
          {icon}
        </IconButton>
      </a>
    </IconColumn>
  );
};

export default UrlColumn;<commit_msg>Remove tooltip for action_URL and  displaying label on tooltip for Notes_Url (#10602)<commit_after>import * as React from 'react';

import { isNil, isEmpty } from 'ramda';

import { Avatar, Tooltip } from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';

import { IconButton } from '@centreon/ui';

import IconColumn from '../IconColumn';

const useStyles = makeStyles((theme) => ({
  avatar: {
    backgroundColor: theme.palette.primary.main,
    fontSize: theme.typography.body2.fontSize,
    height: theme.spacing(2),
    width: theme.spacing(2),
  },
}));

interface Props {
  avatarTitle?: string;
  endpoint?: string;
  icon: JSX.Element;
  title?: string;
}

const UrlColumn = ({
  endpoint,
  title,
  icon,
  avatarTitle,
}: Props): JSX.Element | null => {
  const classes = useStyles();

  const isEndpointEmpty = isNil(endpoint) || isEmpty(endpoint);
  const isTitleEmpty = isNil(title) || isEmpty(title);

  if (isEndpointEmpty && isTitleEmpty) {
    return null;
  }

  if (isEndpointEmpty) {
    return (
      <IconColumn>
        <Tooltip className={classes.avatar} title={title as string}>
          <Avatar>{avatarTitle}</Avatar>
        </Tooltip>
      </IconColumn>
    );
  }

  return (
    <IconColumn>
      <a
        href={endpoint}
        onClick={(e): void => {
          e.stopPropagation();
        }}
      >
        <IconButton
          ariaLabel={title}
          size="large"
          title={title}
          onClick={(): null => {
            return null;
          }}
        >
          {icon}
        </IconButton>
      </a>
    </IconColumn>
  );
};

export default UrlColumn;
{'fraction_non_alphanumeric': 0.14094586185438707, 'fraction_numerical': 0.003422526446795271, 'mean_word_length': 2.5290889132821075, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 35, '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': '1564959', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1022, 'n_words': 227}