diff --git a/desktop/flipper-common/src/doctor.tsx b/desktop/flipper-common/src/doctor.tsx index 909d281ec..0c5cec8ae 100644 --- a/desktop/flipper-common/src/doctor.tsx +++ b/desktop/flipper-common/src/doctor.tsx @@ -64,9 +64,18 @@ export namespace FlipperDoctor { ) => Promise; }; + export type CliCommand = { + title: string; + command: string; + }; + export type HealthcheckRunResult = { hasProblem: boolean; message: string; + /** + * Commands to show to mitigate a problem or hint for more information + */ + commands?: CliCommand[]; }; export type SubprocessHealtcheckRunResult = @@ -104,6 +113,7 @@ export namespace FlipperDoctor { status: HealthcheckStatus; isAcknowledged?: boolean; message?: string; + commands?: CliCommand[]; }; export type HealthcheckReportItem = { diff --git a/desktop/flipper-server-core/src/utils/runHealthchecks.tsx b/desktop/flipper-server-core/src/utils/runHealthchecks.tsx index c60f61c94..0c0890996 100644 --- a/desktop/flipper-server-core/src/utils/runHealthchecks.tsx +++ b/desktop/flipper-server-core/src/utils/runHealthchecks.tsx @@ -71,11 +71,13 @@ export async function runHealthcheck( ? { status: 'FAILED', message: checkResult.message, + commands: checkResult.commands, } : checkResult.hasProblem && !check.isRequired ? { status: 'WARNING', message: checkResult.message, + commands: checkResult.commands, } : {status: 'SUCCESS', message: checkResult.message}; } diff --git a/desktop/flipper-ui-core/src/sandy-chrome/SetupDoctorScreen.tsx b/desktop/flipper-ui-core/src/sandy-chrome/SetupDoctorScreen.tsx index 29d75620e..ba9a3ee9a 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/SetupDoctorScreen.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/SetupDoctorScreen.tsx @@ -13,6 +13,7 @@ import { Typography, Collapse, Button, + List, Modal, Checkbox, Alert, @@ -133,6 +134,25 @@ function CollapsableCategory(props: { header={check.label} extra={}> {check.result.message} + {check.result.commands && ( + + {check.result.commands.map(({title, command}, i) => ( + +
+ {title} + + {command} + +
+
+ ))} +
+ )} ))} @@ -274,7 +294,7 @@ export default function SetupDoctorScreen({ return modal ? (