Migrate PluginDebugger from js to tsx
Summary: Migrated PluginDebugger.js to PluginDebugger.tsx Reviewed By: passy Differential Revision: D16732025 fbshipit-source-id: c4ff5586f823e90eba14eef5a8dac114a058763b
This commit is contained in:
committed by
Facebook Github Bot
parent
8bbc03e138
commit
e4b071e867
@@ -20,7 +20,7 @@ import ShareSheetExportFile from './chrome/ShareSheetExportFile.js';
|
|||||||
import PluginContainer from './PluginContainer.js';
|
import PluginContainer from './PluginContainer.js';
|
||||||
import Sheet from './chrome/Sheet.js';
|
import Sheet from './chrome/Sheet.js';
|
||||||
import {ipcRenderer, remote} from 'electron';
|
import {ipcRenderer, remote} from 'electron';
|
||||||
import PluginDebugger from './chrome/PluginDebugger.js';
|
import PluginDebugger from './chrome/PluginDebugger.tsx';
|
||||||
import {
|
import {
|
||||||
ShareType,
|
ShareType,
|
||||||
ActiveSheet,
|
ActiveSheet,
|
||||||
|
|||||||
@@ -5,12 +5,10 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type {FlipperDevicePlugin, FlipperPlugin} from '../plugin.tsx';
|
import {PluginDefinition} from '../dispatcher/plugins';
|
||||||
import type {PluginDefinition} from '../dispatcher/plugins.tsx';
|
import Client from '../Client';
|
||||||
import type Client from '../Client.tsx';
|
import {TableBodyRow} from '../ui/components/table/types';
|
||||||
import type {TableBodyRow} from '../ui/components/table/types';
|
import React, {Component, Fragment} from 'react';
|
||||||
|
|
||||||
import {Component, Fragment} from 'react';
|
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {
|
import {
|
||||||
FlexColumn,
|
FlexColumn,
|
||||||
@@ -22,6 +20,7 @@ import {
|
|||||||
Link,
|
Link,
|
||||||
} from 'flipper';
|
} from 'flipper';
|
||||||
import StatusIndicator from '../ui/components/StatusIndicator';
|
import StatusIndicator from '../ui/components/StatusIndicator';
|
||||||
|
import {State as Store} from '../reducers';
|
||||||
|
|
||||||
const Container = styled(FlexColumn)({
|
const Container = styled(FlexColumn)({
|
||||||
padding: 10,
|
padding: 10,
|
||||||
@@ -64,16 +63,21 @@ const Lamp = props => (
|
|||||||
<StatusIndicator statusColor={props.on ? colors.lime : colors.red} />
|
<StatusIndicator statusColor={props.on ? colors.lime : colors.red} />
|
||||||
);
|
);
|
||||||
|
|
||||||
type Props = {|
|
type StateFromProps = {
|
||||||
devicePlugins: Array<FlipperDevicePlugin<>>,
|
gatekeepedPlugins: Array<PluginDefinition>;
|
||||||
clientPlugins: Array<FlipperPlugin<>>,
|
disabledPlugins: Array<PluginDefinition>;
|
||||||
gatekeepedPlugins: Array<PluginDefinition>,
|
failedPlugins: Array<[PluginDefinition, string]>;
|
||||||
disabledPlugins: Array<PluginDefinition>,
|
clients: Array<Client>;
|
||||||
failedPlugins: Array<[PluginDefinition, string]>,
|
selectedDevice: string | null | undefined;
|
||||||
clients: Array<Client>,
|
devicePlugins: Array<PluginDefinition>;
|
||||||
selectedDevice: ?string,
|
clientPlugins: Array<PluginDefinition>;
|
||||||
onHide: () => mixed,
|
};
|
||||||
|};
|
|
||||||
|
type DispatchFromProps = {};
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
onHide: () => any;
|
||||||
|
};
|
||||||
|
|
||||||
const COLUMNS = {
|
const COLUMNS = {
|
||||||
lamp: {
|
lamp: {
|
||||||
@@ -105,14 +109,15 @@ const COLUMNS_SIZES = {
|
|||||||
source: 140,
|
source: 140,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type Props = OwnProps & StateFromProps & DispatchFromProps;
|
||||||
class PluginDebugger extends Component<Props> {
|
class PluginDebugger extends Component<Props> {
|
||||||
buildRow(
|
buildRow(
|
||||||
name: string,
|
name: string,
|
||||||
loaded: boolean,
|
loaded: boolean,
|
||||||
status: string,
|
status: string,
|
||||||
GKname: ?string,
|
GKname: string | null | undefined,
|
||||||
GKpassing: ?boolean,
|
GKpassing: boolean | null | undefined,
|
||||||
pluginPath: ?string,
|
pluginPath: string | null | undefined,
|
||||||
): TableBodyRow {
|
): TableBodyRow {
|
||||||
return {
|
return {
|
||||||
key: name.toLowerCase(),
|
key: name.toLowerCase(),
|
||||||
@@ -191,10 +196,8 @@ class PluginDebugger extends Component<Props> {
|
|||||||
plugin.id,
|
plugin.id,
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
// $FlowFixMe: Flow doesn't know this is inherited from FlipperBasePlugin
|
|
||||||
plugin.gatekeeper,
|
plugin.gatekeeper,
|
||||||
true,
|
true,
|
||||||
// $FlowFixMe: Flow doesn't know this is inherited from FlipperBasePlugin
|
|
||||||
externalPluginPath(plugin),
|
externalPluginPath(plugin),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -206,10 +209,8 @@ class PluginDebugger extends Component<Props> {
|
|||||||
plugin.id,
|
plugin.id,
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
// $FlowFixMe: Flow doesn't know this is inherited from FlipperBasePlugin
|
|
||||||
plugin.gatekeeper,
|
plugin.gatekeeper,
|
||||||
true,
|
true,
|
||||||
// $FlowFixMe: Flow doesn't know this is inherited from FlipperBasePlugin
|
|
||||||
externalPluginPath(plugin),
|
externalPluginPath(plugin),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -325,8 +326,7 @@ class PluginDebugger extends Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $FlowFixMe
|
export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
|
||||||
export default connect(
|
|
||||||
({
|
({
|
||||||
plugins: {
|
plugins: {
|
||||||
devicePlugins,
|
devicePlugins,
|
||||||
@@ -343,6 +343,6 @@ export default connect(
|
|||||||
clients,
|
clients,
|
||||||
disabledPlugins,
|
disabledPlugins,
|
||||||
failedPlugins,
|
failedPlugins,
|
||||||
selectedDevice: selectedDevice?.serial,
|
selectedDevice: selectedDevice && selectedDevice.serial,
|
||||||
}),
|
}),
|
||||||
)(PluginDebugger);
|
)(PluginDebugger);
|
||||||
@@ -28,8 +28,9 @@ import {default as config} from '../utils/processConfig';
|
|||||||
import isProduction from '../utils/isProduction';
|
import isProduction from '../utils/isProduction';
|
||||||
|
|
||||||
export type PluginDefinition = {
|
export type PluginDefinition = {
|
||||||
|
id?: string;
|
||||||
name: string;
|
name: string;
|
||||||
out: string;
|
out?: string;
|
||||||
gatekeeper?: string;
|
gatekeeper?: string;
|
||||||
entry?: string;
|
entry?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user