Move flipper-doctor check running to flipper-server-core
Summary: Per title. Two new server API's: get-healthchecks, and run-healtcheck. Types have all been moved to flipper-common, so that they can be used by doctor, server-core and ui-core packages. Since it were quite some, moved them into a FlipperDoctor namespace. Reviewed By: nikoant Differential Revision: D32720510 fbshipit-source-id: 37aa35cde6ebd58479cf0dffec5b7b2da6d22198
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2a4fe77404
commit
2480ed30c5
126
desktop/flipper-common/src/doctor.tsx
Normal file
126
desktop/flipper-common/src/doctor.tsx
Normal file
@@ -0,0 +1,126 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
export namespace FlipperDoctor {
|
||||
export type EnvironmentInfo = {
|
||||
SDKs: {
|
||||
'iOS SDK': {
|
||||
Platforms: string[];
|
||||
};
|
||||
'Android SDK':
|
||||
| {
|
||||
'API Levels': string[] | 'Not Found';
|
||||
'Build Tools': string[] | 'Not Found';
|
||||
'System Images': string[] | 'Not Found';
|
||||
'Android NDK': string | 'Not Found';
|
||||
}
|
||||
| 'Not Found';
|
||||
};
|
||||
IDEs: {
|
||||
Xcode: {
|
||||
version: string;
|
||||
path: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export type HealthcheckCategory = {
|
||||
label: string;
|
||||
isSkipped: false;
|
||||
isRequired: boolean;
|
||||
healthchecks: Healthcheck[];
|
||||
};
|
||||
|
||||
export type SkippedHealthcheckCategory = {
|
||||
label: string;
|
||||
isSkipped: true;
|
||||
skipReason: string;
|
||||
};
|
||||
|
||||
export type Healthchecks = {
|
||||
common: HealthcheckCategory | SkippedHealthcheckCategory;
|
||||
android: HealthcheckCategory | SkippedHealthcheckCategory;
|
||||
ios: HealthcheckCategory | SkippedHealthcheckCategory;
|
||||
};
|
||||
|
||||
export type Settings = {
|
||||
idbPath: string;
|
||||
enablePhysicalIOS: boolean;
|
||||
};
|
||||
|
||||
export type Healthcheck = {
|
||||
key: string;
|
||||
label: string;
|
||||
isRequired?: boolean;
|
||||
run?: (
|
||||
env: EnvironmentInfo,
|
||||
settings?: Settings,
|
||||
) => Promise<HealthcheckRunResult>;
|
||||
};
|
||||
|
||||
export type HealthcheckRunResult = {
|
||||
hasProblem: boolean;
|
||||
message: string;
|
||||
};
|
||||
|
||||
export type CategoryResult = [
|
||||
string,
|
||||
{
|
||||
label: string;
|
||||
results: Array<{
|
||||
key: string;
|
||||
label: string;
|
||||
isRequired: boolean;
|
||||
result: {hasProblem: boolean};
|
||||
}>;
|
||||
},
|
||||
];
|
||||
|
||||
export type Dictionary<T> = {[key: string]: T};
|
||||
|
||||
export type HealthcheckStatus =
|
||||
| 'IN_PROGRESS'
|
||||
| 'SUCCESS'
|
||||
| 'FAILED'
|
||||
| 'SKIPPED'
|
||||
| 'WARNING';
|
||||
|
||||
export type HealthcheckResult = {
|
||||
status: HealthcheckStatus;
|
||||
isAcknowledged?: boolean;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
export type HealthcheckReportItem = {
|
||||
key: string;
|
||||
label: string;
|
||||
result: HealthcheckResult;
|
||||
};
|
||||
|
||||
export type HealthcheckReportCategory = {
|
||||
key: string;
|
||||
label: string;
|
||||
result: HealthcheckResult;
|
||||
checks: Dictionary<HealthcheckReportItem>;
|
||||
};
|
||||
|
||||
export type HealthcheckReport = {
|
||||
result: HealthcheckResult;
|
||||
categories: Dictionary<HealthcheckReportCategory>;
|
||||
};
|
||||
|
||||
export type HealthcheckSettings = {
|
||||
settings: {
|
||||
enableAndroid: boolean;
|
||||
enableIOS: boolean;
|
||||
enablePhysicalIOS: boolean;
|
||||
idbPath: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -47,3 +47,4 @@ export * from './GK';
|
||||
export * from './clientUtils';
|
||||
export * from './settings';
|
||||
export * from './PluginDetails';
|
||||
export * from './doctor';
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {FlipperDoctor} from './doctor';
|
||||
import {
|
||||
BundledPluginDetails,
|
||||
DeviceSpec,
|
||||
@@ -180,6 +181,14 @@ export type FlipperServerCommands = {
|
||||
path: string,
|
||||
) => Promise<InstalledPluginDetails>;
|
||||
'plugins-remove-plugins': (names: string[]) => Promise<void>;
|
||||
'doctor-get-healthchecks': (
|
||||
settings: FlipperDoctor.HealthcheckSettings,
|
||||
) => Promise<FlipperDoctor.Healthchecks>;
|
||||
'doctor-run-healthcheck': (
|
||||
settings: FlipperDoctor.HealthcheckSettings,
|
||||
category: keyof FlipperDoctor.Healthchecks,
|
||||
name: string,
|
||||
) => Promise<FlipperDoctor.HealthcheckResult>;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user