mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
import React from "react";
|
|
|
|
import { getPathWithQueryParams } from "utilities/url";
|
|
import CustomLink from "components/CustomLink";
|
|
import paths from "router/paths";
|
|
|
|
interface IRunScriptHelpTextProps {
|
|
className?: string;
|
|
isTechnician: boolean;
|
|
canRunScripts: boolean;
|
|
teamId?: number;
|
|
}
|
|
|
|
const RunScriptHelpText = ({
|
|
className,
|
|
isTechnician,
|
|
canRunScripts,
|
|
teamId,
|
|
}: IRunScriptHelpTextProps) => {
|
|
const hostsUrl = getPathWithQueryParams(paths.MANAGE_HOSTS, {
|
|
fleet_id: teamId,
|
|
});
|
|
|
|
if (isTechnician) {
|
|
return (
|
|
<div className={className}>
|
|
To run this script on a host, go to the{" "}
|
|
<CustomLink text="Hosts" url={hostsUrl} /> page and select a host. Then,
|
|
click <b>Actions > Run script</b>.
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className={className}>
|
|
To run this script on a host, go to the{" "}
|
|
<CustomLink text="Hosts" url={hostsUrl} /> page and select a host.
|
|
{canRunScripts && (
|
|
<>
|
|
<br />
|
|
To run the script across multiple hosts, add a policy automation on
|
|
the{" "}
|
|
<CustomLink
|
|
text="Policies"
|
|
url={getPathWithQueryParams(paths.MANAGE_POLICIES, {
|
|
fleet_id: teamId,
|
|
})}
|
|
/>{" "}
|
|
page.
|
|
</>
|
|
)}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default RunScriptHelpText;
|