2021-10-19 18:15:48 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import ReactTooltip from "react-tooltip";
|
|
|
|
|
import { isEmpty } from "lodash";
|
|
|
|
|
|
2022-12-07 17:59:38 +00:00
|
|
|
import Icon from "components/Icon";
|
|
|
|
|
|
2023-11-06 18:34:06 +00:00
|
|
|
const baseClass = "issue-cell";
|
|
|
|
|
|
2021-10-19 18:15:48 +00:00
|
|
|
interface IIssueCellProps<T> {
|
|
|
|
|
issues: {
|
|
|
|
|
total_issues_count: number;
|
|
|
|
|
failing_policies_count: number;
|
|
|
|
|
};
|
|
|
|
|
rowId: number;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-10 15:10:44 +00:00
|
|
|
const IssueCell = ({ issues, rowId }: IIssueCellProps<any>): JSX.Element => {
|
2021-10-19 18:15:48 +00:00
|
|
|
if (isEmpty(issues) || issues.total_issues_count === 0) {
|
2022-03-10 15:10:44 +00:00
|
|
|
return <></>;
|
2021-10-19 18:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<span
|
2023-11-06 18:34:06 +00:00
|
|
|
className={`${baseClass}__icon tooltip tooltip__tooltip-icon`}
|
2021-10-19 18:15:48 +00:00
|
|
|
data-tip
|
|
|
|
|
data-for={`host-issue__${rowId.toString()}`}
|
|
|
|
|
data-tip-disable={false}
|
|
|
|
|
>
|
2023-11-03 11:41:13 +00:00
|
|
|
<Icon name="error-outline" color="ui-fleet-black-50" size="small" />
|
2021-10-19 18:15:48 +00:00
|
|
|
</span>
|
|
|
|
|
<ReactTooltip
|
2022-11-22 22:15:17 +00:00
|
|
|
place="top"
|
2021-10-19 18:15:48 +00:00
|
|
|
effect="solid"
|
|
|
|
|
backgroundColor="#3e4771"
|
|
|
|
|
id={`host-issue__${rowId.toString()}`}
|
|
|
|
|
data-html
|
|
|
|
|
>
|
|
|
|
|
<span className={`tooltip__tooltip-text`}>
|
|
|
|
|
Failing policies ({issues.failing_policies_count})
|
|
|
|
|
</span>
|
|
|
|
|
</ReactTooltip>
|
|
|
|
|
<span className={`total-issues-count`}>{issues.total_issues_count}</span>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default IssueCell;
|