mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
relates to #18677 implement UI API integrations and polish tasks for the software install feature. These include various tasks to finish up this feature on the UI and ensure its working correctly - [x] Manual QA for all new/changed functionality
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import React from "react";
|
|
import { InjectedRouter } from "react-router";
|
|
|
|
import Icon from "components/Icon";
|
|
|
|
import SoftwareIcon from "pages/SoftwarePage/components/icons/SoftwareIcon";
|
|
|
|
import LinkCell from "../LinkCell";
|
|
|
|
const baseClass = "software-name-cell";
|
|
|
|
interface ISoftwareNameCellProps {
|
|
name: string;
|
|
source: string;
|
|
path?: string;
|
|
router?: InjectedRouter;
|
|
hasPackage?: boolean;
|
|
}
|
|
|
|
const SoftwareNameCell = ({
|
|
name,
|
|
source,
|
|
path,
|
|
router,
|
|
hasPackage = false,
|
|
}: ISoftwareNameCellProps) => {
|
|
// NO path or router means it's not clickable. return
|
|
// a non-clickable cell early
|
|
if (!router || !path) {
|
|
return (
|
|
<div className={baseClass}>
|
|
<SoftwareIcon name={name} source={source} />
|
|
<span className="software-name">{name}</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const onClickSoftware = (e: React.MouseEvent) => {
|
|
// Allows for button to be clickable in a clickable row
|
|
e.stopPropagation();
|
|
router.push(path);
|
|
};
|
|
|
|
return (
|
|
<LinkCell
|
|
className={baseClass}
|
|
path={path}
|
|
customOnClick={onClickSoftware}
|
|
value={
|
|
<>
|
|
<SoftwareIcon name={name} source={source} />
|
|
<span className="software-name">{name}</span>
|
|
{hasPackage && (
|
|
<Icon name="install" className={`${baseClass}__install-icon`} />
|
|
)}
|
|
</>
|
|
}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default SoftwareNameCell;
|