2023-02-22 21:27:02 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import ReactTooltip from "react-tooltip";
|
|
|
|
|
|
|
|
|
|
import Icon from "components/Icon";
|
2023-12-09 00:54:24 +00:00
|
|
|
import { COLORS } from "styles/var/colors";
|
2023-02-22 21:27:02 +00:00
|
|
|
|
|
|
|
|
interface ILiveQueryIssueCellProps<T> {
|
|
|
|
|
displayName: string;
|
|
|
|
|
distributedInterval: number;
|
|
|
|
|
status: string;
|
|
|
|
|
rowId: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const LiveQueryIssueCell = ({
|
|
|
|
|
displayName,
|
|
|
|
|
distributedInterval,
|
|
|
|
|
status,
|
|
|
|
|
rowId,
|
|
|
|
|
}: ILiveQueryIssueCellProps<any>): JSX.Element => {
|
|
|
|
|
if (distributedInterval < 60 && status === "online") {
|
|
|
|
|
return <>{displayName}</>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
{displayName}{" "}
|
|
|
|
|
<span
|
|
|
|
|
className={`host-issue tooltip tooltip__tooltip-icon`}
|
|
|
|
|
data-tip
|
|
|
|
|
data-for={`host-issue__${rowId.toString()}`}
|
|
|
|
|
data-tip-disable={false}
|
|
|
|
|
>
|
|
|
|
|
<Icon
|
2023-10-31 16:06:38 +00:00
|
|
|
name="error-outline"
|
2023-02-22 21:27:02 +00:00
|
|
|
size="small"
|
|
|
|
|
color={status === "offline" ? "status-error" : "status-warning"}
|
|
|
|
|
/>
|
|
|
|
|
</span>
|
|
|
|
|
<ReactTooltip
|
|
|
|
|
place="top"
|
|
|
|
|
effect="solid"
|
2023-12-09 00:54:24 +00:00
|
|
|
backgroundColor={COLORS["tooltip-bg"]}
|
2023-02-22 21:27:02 +00:00
|
|
|
id={`host-issue__${rowId.toString()}`}
|
|
|
|
|
data-html
|
|
|
|
|
>
|
|
|
|
|
<span className={`tooltip__tooltip-text`}>
|
|
|
|
|
{status === "offline" ? (
|
|
|
|
|
<>
|
|
|
|
|
Offline hosts will not <br />
|
|
|
|
|
respond to a live query.
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
This host might take up to
|
|
|
|
|
<br /> {distributedInterval} seconds to respond.
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</span>
|
|
|
|
|
</ReactTooltip>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default LiveQueryIssueCell;
|