fleet/frontend/components/TableContainer/DataTable/SoftwareNameCell/SoftwareNameCell.tsx
Gabriel Hernandez fc1c903f63
add UI on host details and my device page for installing software feature (#18878)
relates to #18327

This adds the ui changes for installing software feature on the host
details and my device page. this includes:

**new software tables for host details and my device pages:**

<img width="1667" alt="image"
src="https://github.com/fleetdm/fleet/assets/1153709/edb8921a-ac24-4bc9-9d8b-4b2f8df9b5b8">

**new actions dropdown to install and see details:**

<img width="211" alt="image"
src="https://github.com/fleetdm/fleet/assets/1153709/37094536-83fb-477f-b8b2-adac3aa20105">

**new software details modal:**

<img width="674" alt="image"
src="https://github.com/fleetdm/fleet/assets/1153709/51fc12bb-3904-4c38-a71a-a5c6d5065bee">

**use new API for showing host software in the UI:**

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Manual QA for all new/changed functionality
2024-05-09 22:44:50 +01:00

55 lines
1.2 KiB
TypeScript

import React from "react";
import { InjectedRouter } from "react-router";
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;
}
const SoftwareNameCell = ({
name,
source,
path,
router,
}: 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>
</>
}
/>
);
};
export default SoftwareNameCell;