mirror of
https://github.com/fleetdm/fleet
synced 2026-04-28 00:47:22 +00:00
Issues https://github.com/fleetdm/fleet/issues/17587, https://github.com/fleetdm/fleet/issues/18836, https://github.com/fleetdm/fleet/issues/18837, https://github.com/fleetdm/fleet/pull/18339, and https://github.com/fleetdm/fleet/pull/18340 # TODOS - Integrate backend - Unit/integration tests - Various todos noted in comments - Cleanup styles and organization of components (de-duplicating and consolidating where possible) - Activity feed updates (if any) # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [ ] 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. - [ ] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for new osquery data ingestion features. - [ ] Added/updated tests - [ ] If database migrations are included, checked table schema to confirm autoupdate - For database migrations: - [ ] Checked schema for all modified table for columns that will auto-update timestamps during migration. - [ ] Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects. - [ ] Ensured the correct collation is explicitly set for character columns (`COLLATE utf8mb4_unicode_ci`). - [ ] Manual QA for all new/changed functionality - For Orbit and Fleet Desktop changes: - [ ] Manual QA must be performed in the three main OSs, macOS, Windows and Linux. - [ ] Auto-update manual QA, from released version of component to new version (see [tools/tuf/test](../tools/tuf/test/README.md)). --------- Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
109 lines
2.6 KiB
TypeScript
109 lines
2.6 KiB
TypeScript
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 (
|
|
<div className={`${baseClass}__install-icon-with-tooltip`}>
|
|
<div
|
|
className={`${baseClass}__install-icon-tooltip`}
|
|
data-tip
|
|
data-for={tooltipId}
|
|
>
|
|
<Icon
|
|
name={isSelfService ? "install-self-service" : "install"}
|
|
className={`${baseClass}__install-icon`}
|
|
/>
|
|
</div>
|
|
<ReactTooltip
|
|
className={`${baseClass}__install-tooltip`}
|
|
place="top"
|
|
effect="solid"
|
|
backgroundColor="#3e4771"
|
|
id={tooltipId}
|
|
data-html
|
|
>
|
|
<span className={`${baseClass}__install-tooltip-text`}>
|
|
{isSelfService ? (
|
|
<>
|
|
End users can install from <b>Fleet Desktop {">"} Self-service</b>
|
|
.
|
|
</>
|
|
) : (
|
|
"Software can be installed on Host details page."
|
|
)}
|
|
</span>
|
|
</ReactTooltip>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
interface ISoftwareNameCellProps {
|
|
name: string;
|
|
source: string;
|
|
path?: string;
|
|
router?: InjectedRouter;
|
|
hasPackage?: boolean;
|
|
isSelfService?: boolean;
|
|
}
|
|
|
|
const SoftwareNameCell = ({
|
|
name,
|
|
source,
|
|
path,
|
|
router,
|
|
hasPackage = false,
|
|
isSelfService = 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 && (
|
|
<InstallIconWithTooltip isSelfService={isSelfService} />
|
|
)}
|
|
</>
|
|
}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default SoftwareNameCell;
|