import React from "react";
import { InjectedRouter } from "react-router";
import ReactTooltip from "react-tooltip";
import { uniqueId } from "lodash";
import { ISoftwarePackage } from "interfaces/software";
import Icon from "components/Icon";
import SoftwareIcon from "pages/SoftwarePage/components/icons/SoftwareIcon";
import LinkCell from "../LinkCell";
const baseClass = "software-name-cell";
const InstallIconWithTooltip = ({
isSelfService,
}: {
isSelfService: ISoftwarePackage["self_service"];
}) => {
const tooltipId = uniqueId();
return (
{isSelfService ? (
<>
End users can install from Fleet Desktop {">"} Self-service
.
>
) : (
"Software can be installed on Host details page."
)}
);
};
interface ISoftwareNameCellProps {
name: string;
source: string;
path?: string;
router?: InjectedRouter;
hasPackage?: boolean;
isSelfService?: boolean;
iconUrl?: string;
}
const SoftwareNameCell = ({
name,
source,
path,
router,
hasPackage = false,
isSelfService = false,
iconUrl,
}: ISoftwareNameCellProps) => {
// NO path or router means it's not clickable. return
// a non-clickable cell early
if (!router || !path) {
return (
{name}
);
}
const onClickSoftware = (e: React.MouseEvent) => {
// Allows for button to be clickable in a clickable row
e.stopPropagation();
router.push(path);
};
return (
{name}
{hasPackage && (
)}
>
}
/>
);
};
export default SoftwareNameCell;