mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** For #41030 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [ ] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. n/a ## Testing - [ ] Added/updated automated tests - [X] QA'd all new/changed functionality manually **Query report "Export results" file name (just dropped "Query")** <img width="481" height="35" alt="image" src="https://github.com/user-attachments/assets/c7529f1d-07d3-467c-868c-e4b49f4b6eec" /> --- **Tooltips on the New Report page** <img width="308" height="109" alt="image" src="https://github.com/user-attachments/assets/886cb49c-664a-46f3-bbe3-35712644f7ad" /> <img width="309" height="82" alt="image" src="https://github.com/user-attachments/assets/bb76f48c-548e-4059-835b-b8861f71d37a" /> --- **Report automations Example data tooltip** <img width="619" height="87" alt="image" src="https://github.com/user-attachments/assets/d400bcad-fca9-413d-a4c3-bdd2c2167d1b" /> --- **Activities filter** <img width="433" height="350" alt="image" src="https://github.com/user-attachments/assets/cf6379cc-7d64-4e0e-91bd-034e41eeec1f" /> <img width="414" height="382" alt="image" src="https://github.com/user-attachments/assets/4da59326-732d-481c-bacb-8db2965c7bb5" /> -- **Created/Edited/Deleted query activity** <img width="403" height="254" alt="image" src="https://github.com/user-attachments/assets/a87dec83-958d-4803-b42b-28e9683b3a8b" /> For unreleased bug fixes in a release candidate, one of: - [X] Confirmed that the fix is not expected to adversely impact load test results
112 lines
2.8 KiB
TypeScript
112 lines
2.8 KiB
TypeScript
import React from "react";
|
|
|
|
import {
|
|
DisplayPlatform,
|
|
QueryableDisplayPlatform,
|
|
QueryablePlatform,
|
|
} from "interfaces/platform";
|
|
import { PLATFORM_DISPLAY_NAMES } from "utilities/constants";
|
|
|
|
import TooltipWrapper from "components/TooltipWrapper";
|
|
import Icon from "components/Icon";
|
|
|
|
interface IPlatformCompatibilityProps {
|
|
compatiblePlatforms: any[] | null;
|
|
error: Error | null;
|
|
}
|
|
|
|
const baseClass = "platform-compatibility";
|
|
|
|
const DISPLAY_ORDER = [
|
|
"macOS",
|
|
"Windows",
|
|
"Linux",
|
|
"ChromeOS",
|
|
] as QueryableDisplayPlatform[];
|
|
|
|
const ERROR_NO_COMPATIBLE_TABLES = Error("no tables in query");
|
|
|
|
const formatPlatformsForDisplay = (
|
|
compatiblePlatforms: QueryablePlatform[]
|
|
): DisplayPlatform[] => {
|
|
return compatiblePlatforms.map((str) => PLATFORM_DISPLAY_NAMES[str] || str);
|
|
};
|
|
|
|
const displayIncompatibilityText = (err: Error) => {
|
|
switch (err) {
|
|
case ERROR_NO_COMPATIBLE_TABLES:
|
|
return (
|
|
<span>
|
|
No platforms (check your query for invalid tables or tables that are
|
|
supported on different platforms)
|
|
</span>
|
|
);
|
|
default:
|
|
return (
|
|
<span>No platforms (check your query for a possible syntax error)</span>
|
|
);
|
|
}
|
|
};
|
|
|
|
const tipContent = (
|
|
<>
|
|
Estimated compatibility based on the tables <br />
|
|
used in the query. Reports are not supported <br />
|
|
on iPhones, iPads, and Android hosts.
|
|
</>
|
|
);
|
|
|
|
const PlatformCompatibility = ({
|
|
compatiblePlatforms,
|
|
error,
|
|
}: IPlatformCompatibilityProps): JSX.Element | null => {
|
|
if (!compatiblePlatforms) {
|
|
return null;
|
|
}
|
|
|
|
const displayPlatforms = formatPlatformsForDisplay(compatiblePlatforms);
|
|
|
|
const renderCompatiblePlatforms = () => {
|
|
if (error || !compatiblePlatforms?.length) {
|
|
return displayIncompatibilityText(error || ERROR_NO_COMPATIBLE_TABLES);
|
|
}
|
|
|
|
return DISPLAY_ORDER.map((platform) => {
|
|
const isCompatible = displayPlatforms.includes(platform);
|
|
|
|
const liveQueryOnlyPlatform = (
|
|
<TooltipWrapper
|
|
tipContent={`Only live reports are supported on ${platform}.`}
|
|
>
|
|
{platform}
|
|
</TooltipWrapper>
|
|
);
|
|
|
|
return (
|
|
<span key={`platform-compatibility__${platform}`} className="platform">
|
|
<Icon
|
|
name={isCompatible ? "check" : "close"}
|
|
className={
|
|
isCompatible ? "compatible-platform" : "incompatible-platform"
|
|
}
|
|
color={isCompatible ? "status-success" : "status-error"}
|
|
size="small"
|
|
/>
|
|
{platform === "ChromeOS" ? liveQueryOnlyPlatform : platform}
|
|
</span>
|
|
);
|
|
});
|
|
};
|
|
|
|
return (
|
|
<div className={baseClass}>
|
|
<b>
|
|
<TooltipWrapper tipContent={tipContent} clickable={false}>
|
|
Compatible with:
|
|
</TooltipWrapper>
|
|
</b>
|
|
{renderCompatiblePlatforms()}
|
|
</div>
|
|
);
|
|
};
|
|
export default PlatformCompatibility;
|