fleet/frontend/interfaces/script.ts
Juan Fernandez e7519eef48
29762: Fixed bug with run script modal on FreeTier. (#30138)
For #29762 

When running on FreeTier do not apply teamId criteria on end-point used by the Run Script modal.
2025-06-23 13:03:22 -04:00

34 lines
966 B
TypeScript

import { HOST_LINUX_PLATFORMS } from "./platform";
export interface IScript {
id: number;
team_id: number | null;
name: string;
created_at: string;
updated_at: string;
}
export const isScriptSupportedPlatform = (hostPlatform: string) =>
["darwin", "windows", ...HOST_LINUX_PLATFORMS].includes(hostPlatform); // excludes chrome, ios, ipados, android see also https://github.com/fleetdm/fleet/blob/5a21e2cfb029053ddad0508869eb9f1f23997bf2/server/fleet/hosts.go#L775
export const addTeamIdCriteria = (
pred: any,
teamId: number,
isFreeTier?: boolean
) => (isFreeTier ? { ...pred } : { ...pred, team_id: teamId });
export type IScriptExecutionStatus = "ran" | "pending" | "error";
export interface ILastExecution {
execution_id: string;
executed_at: string;
status: IScriptExecutionStatus;
}
export type ScriptContent = string;
export interface IHostScript {
script_id: number;
name: string;
last_execution: ILastExecution | null;
}