UI – Only render SW version tooltip for > 1 version (#19003)

## Addresses #18852 

![Screenshot-2024-05-14-at-41502PM](https://github.com/fleetdm/fleet/assets/61553566/04e2ae9c-613e-49ba-95df-e2915e1427df)

- [x] Changes file added for user-visible changes in `changes/`
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
Jacob Shandling
2024-05-16 12:52:39 -07:00
committed by GitHub
co-authored by Jacob Shandling
parent f87906b1d1
commit 7cc39cdc3e
3 changed files with 4 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
- Fix a bug where a singular software version in the Software table generated a tooltip unnecessarily.
@@ -4,8 +4,6 @@ import { IconNames } from "components/icons";
// @ts-ignore
import InputFieldWithIcon from "../InputFieldWithIcon";
const baseClass = "search-field";
export interface ISearchFieldProps {
placeholder: string;
defaultValue?: string;
@@ -37,7 +35,6 @@ const SearchField = ({
name={icon}
placeholder={placeholder}
value={searchQueryInput}
// inputWrapperClass={`${baseClass}__input-wrapper`}
onChange={onInputChange}
onClick={onClick}
iconPosition="start"
@@ -44,14 +44,14 @@ interface IVersionCellProps {
}
const VersionCell = ({ versions }: IVersionCellProps) => {
const tooltipId = uniqueId();
// only one version, no need for tooltip
const cellText = generateText(versions);
if (!versions) {
if (!versions || versions.length <= 1) {
return <>{cellText}</>;
}
const tooltipId = uniqueId();
const versionTooltip = generateTooltip(versions, tooltipId);
return (
<>