doctor result can display copiable CLI commands
Reviewed By: lblasa, ivanmisuno Differential Revision: D50383150 fbshipit-source-id: 201f239cc7d69bd03011ec817156163f9f6ed653
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a0a9465c0b
commit
683fbfd6fb
@@ -64,9 +64,18 @@ export namespace FlipperDoctor {
|
|||||||
) => Promise<HealthcheckRunResult>;
|
) => Promise<HealthcheckRunResult>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type CliCommand = {
|
||||||
|
title: string;
|
||||||
|
command: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type HealthcheckRunResult = {
|
export type HealthcheckRunResult = {
|
||||||
hasProblem: boolean;
|
hasProblem: boolean;
|
||||||
message: string;
|
message: string;
|
||||||
|
/**
|
||||||
|
* Commands to show to mitigate a problem or hint for more information
|
||||||
|
*/
|
||||||
|
commands?: CliCommand[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SubprocessHealtcheckRunResult =
|
export type SubprocessHealtcheckRunResult =
|
||||||
@@ -104,6 +113,7 @@ export namespace FlipperDoctor {
|
|||||||
status: HealthcheckStatus;
|
status: HealthcheckStatus;
|
||||||
isAcknowledged?: boolean;
|
isAcknowledged?: boolean;
|
||||||
message?: string;
|
message?: string;
|
||||||
|
commands?: CliCommand[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HealthcheckReportItem = {
|
export type HealthcheckReportItem = {
|
||||||
|
|||||||
@@ -71,11 +71,13 @@ export async function runHealthcheck(
|
|||||||
? {
|
? {
|
||||||
status: 'FAILED',
|
status: 'FAILED',
|
||||||
message: checkResult.message,
|
message: checkResult.message,
|
||||||
|
commands: checkResult.commands,
|
||||||
}
|
}
|
||||||
: checkResult.hasProblem && !check.isRequired
|
: checkResult.hasProblem && !check.isRequired
|
||||||
? {
|
? {
|
||||||
status: 'WARNING',
|
status: 'WARNING',
|
||||||
message: checkResult.message,
|
message: checkResult.message,
|
||||||
|
commands: checkResult.commands,
|
||||||
}
|
}
|
||||||
: {status: 'SUCCESS', message: checkResult.message};
|
: {status: 'SUCCESS', message: checkResult.message};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
Collapse,
|
Collapse,
|
||||||
Button,
|
Button,
|
||||||
|
List,
|
||||||
Modal,
|
Modal,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Alert,
|
Alert,
|
||||||
@@ -133,6 +134,25 @@ function CollapsableCategory(props: {
|
|||||||
header={check.label}
|
header={check.label}
|
||||||
extra={<CheckIcon status={check.result.status} />}>
|
extra={<CheckIcon status={check.result.status} />}>
|
||||||
<Paragraph>{check.result.message}</Paragraph>
|
<Paragraph>{check.result.message}</Paragraph>
|
||||||
|
{check.result.commands && (
|
||||||
|
<List>
|
||||||
|
{check.result.commands.map(({title, command}, i) => (
|
||||||
|
<List.Item key={i}>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
marginBottom: 8,
|
||||||
|
}}>
|
||||||
|
<Typography.Text type="secondary">{title}</Typography.Text>
|
||||||
|
<Typography.Text code copyable>
|
||||||
|
{command}
|
||||||
|
</Typography.Text>
|
||||||
|
</div>
|
||||||
|
</List.Item>
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
)}
|
||||||
</Collapse.Panel>
|
</Collapse.Panel>
|
||||||
))}
|
))}
|
||||||
</Collapse>
|
</Collapse>
|
||||||
@@ -274,7 +294,7 @@ export default function SetupDoctorScreen({
|
|||||||
return modal ? (
|
return modal ? (
|
||||||
<Modal
|
<Modal
|
||||||
centered
|
centered
|
||||||
width={570}
|
width={620}
|
||||||
title="Setup Doctor"
|
title="Setup Doctor"
|
||||||
open={visible}
|
open={visible}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
|
|||||||
Reference in New Issue
Block a user