SonarPlugin > FlipperPlugin
Summary: Renaming: - `SonarPlugin` > `FlipperPlugin` - `SonarBasePlugin` > `FlipperBasePlugin` - `SonarDevicePlugin` > `FlipperDevicePlugin` Reviewed By: passy Differential Revision: D9851075 fbshipit-source-id: d59df6952a42eb493c86c38895216c9985f1e14b
This commit is contained in:
committed by
Facebook Github Bot
parent
47ec499973
commit
2e2924c979
@@ -5,7 +5,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {SonarPlugin} from './plugin.js';
|
||||
import type {FlipperPlugin} from './plugin.js';
|
||||
import type {App} from './App.js';
|
||||
import type Logger from './fb-stubs/Logger.js';
|
||||
|
||||
@@ -88,7 +88,7 @@ export default class Client extends EventEmitter {
|
||||
|},
|
||||
>;
|
||||
|
||||
supportsPlugin(Plugin: Class<SonarPlugin<>>): boolean {
|
||||
supportsPlugin(Plugin: Class<FlipperPlugin<>>): boolean {
|
||||
return this.plugins.includes(Plugin.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {SonarBasePlugin} from './plugin.js';
|
||||
import type {FlipperBasePlugin} from './plugin.js';
|
||||
|
||||
import {devicePlugins} from './device-plugins/index.js';
|
||||
import plugins from './plugins/index.js';
|
||||
@@ -70,7 +70,7 @@ export function setupMenuBar() {
|
||||
// collect all keyboard actions from all plugins
|
||||
const registeredActions: Set<?KeyboardAction> = new Set(
|
||||
[...devicePlugins, ...plugins]
|
||||
.map((plugin: Class<SonarBasePlugin<>>) => plugin.keyboardActions || [])
|
||||
.map((plugin: Class<FlipperBasePlugin<>>) => plugin.keyboardActions || [])
|
||||
.reduce((acc: KeyboardActions, cv) => acc.concat(cv), [])
|
||||
.map(
|
||||
(action: DefaultKeyboardAction | KeyboardAction) =>
|
||||
@@ -133,7 +133,7 @@ function appendMenuItem(
|
||||
}
|
||||
}
|
||||
|
||||
export function activateMenuItems(activePlugin: SonarBasePlugin<>) {
|
||||
export function activateMenuItems(activePlugin: FlipperBasePlugin<>) {
|
||||
// disable all keyboard actions
|
||||
for (const item of menuItems) {
|
||||
item[1].enabled = false;
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
import type {SonarPlugin, SonarBasePlugin} from './plugin.js';
|
||||
import type {FlipperPlugin, FlipperBasePlugin} from './plugin.js';
|
||||
import type LogManager from './fb-stubs/Logger';
|
||||
import type Client from './Client.js';
|
||||
import type BaseDevice from './devices/BaseDevice.js';
|
||||
import type {Props as PluginProps} from './plugin';
|
||||
|
||||
import {SonarDevicePlugin} from './plugin.js';
|
||||
import {FlipperDevicePlugin} from './plugin.js';
|
||||
import {
|
||||
ErrorBoundary,
|
||||
Component,
|
||||
@@ -55,7 +55,7 @@ type Props = {
|
||||
};
|
||||
|
||||
type State = {
|
||||
activePlugin: ?Class<SonarBasePlugin<>>,
|
||||
activePlugin: ?Class<FlipperBasePlugin<>>,
|
||||
target: Client | BaseDevice | null,
|
||||
pluginKey: string,
|
||||
};
|
||||
@@ -63,7 +63,7 @@ type State = {
|
||||
function computeState(props: Props): State {
|
||||
// plugin changed
|
||||
let activePlugin = devicePlugins.find(
|
||||
(p: Class<SonarDevicePlugin<>>) => p.id === props.selectedPlugin,
|
||||
(p: Class<FlipperDevicePlugin<>>) => p.id === props.selectedPlugin,
|
||||
);
|
||||
let target = props.selectedDevice;
|
||||
let pluginKey = 'unknown';
|
||||
@@ -74,7 +74,7 @@ function computeState(props: Props): State {
|
||||
(client: Client) => client.id === props.selectedApp,
|
||||
);
|
||||
activePlugin = plugins.find(
|
||||
(p: Class<SonarPlugin<>>) => p.id === props.selectedPlugin,
|
||||
(p: Class<FlipperPlugin<>>) => p.id === props.selectedPlugin,
|
||||
);
|
||||
if (!activePlugin || !target) {
|
||||
throw new Error(
|
||||
@@ -92,7 +92,7 @@ function computeState(props: Props): State {
|
||||
}
|
||||
|
||||
class PluginContainer extends Component<Props, State> {
|
||||
plugin: ?SonarBasePlugin<>;
|
||||
plugin: ?FlipperBasePlugin<>;
|
||||
|
||||
constructor(props: Props) {
|
||||
super();
|
||||
@@ -109,7 +109,7 @@ class PluginContainer extends Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
refChanged = (ref: ?SonarBasePlugin<>) => {
|
||||
refChanged = (ref: ?FlipperBasePlugin<>) => {
|
||||
if (this.plugin) {
|
||||
this.plugin._teardown();
|
||||
this.plugin = null;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
*/
|
||||
|
||||
import type {
|
||||
SonarPlugin,
|
||||
SonarDevicePlugin,
|
||||
SonarBasePlugin,
|
||||
FlipperPlugin,
|
||||
FlipperDevicePlugin,
|
||||
FlipperBasePlugin,
|
||||
} from '../plugin.js';
|
||||
import type BaseDevice from '../devices/BaseDevice.js';
|
||||
import type Client from '../Client.js';
|
||||
@@ -97,7 +97,7 @@ function PluginIcon({
|
||||
class PluginSidebarListItem extends Component<{
|
||||
onClick: () => void,
|
||||
isActive: boolean,
|
||||
plugin: Class<SonarBasePlugin<>>,
|
||||
plugin: Class<FlipperBasePlugin<>>,
|
||||
app?: ?string,
|
||||
}> {
|
||||
render() {
|
||||
@@ -185,7 +185,7 @@ class MainSidebar extends Component<MainSidebarProps> {
|
||||
{selectedDevice &&
|
||||
devicePlugins
|
||||
.filter(selectedDevice.supportsPlugin)
|
||||
.map((plugin: Class<SonarDevicePlugin<>>) => (
|
||||
.map((plugin: Class<FlipperDevicePlugin<>>) => (
|
||||
<PluginSidebarListItem
|
||||
key={plugin.id}
|
||||
isActive={plugin.id === selectedPlugin}
|
||||
@@ -212,10 +212,10 @@ class MainSidebar extends Component<MainSidebarProps> {
|
||||
<SidebarHeader>{client.query.app}</SidebarHeader>
|
||||
{plugins
|
||||
.filter(
|
||||
(p: Class<SonarPlugin<>>) =>
|
||||
(p: Class<FlipperPlugin<>>) =>
|
||||
client.plugins.indexOf(p.id) > -1,
|
||||
)
|
||||
.map((plugin: Class<SonarPlugin<>>) => (
|
||||
.map((plugin: Class<FlipperPlugin<>>) => (
|
||||
<PluginSidebarListItem
|
||||
key={plugin.id}
|
||||
isActive={
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {
|
||||
import {FlexColumn, Button, SonarSidebar} from 'sonar';
|
||||
import textContent from './utils/textContent.js';
|
||||
import createPaste from './utils/createPaste.js';
|
||||
import {SonarPlugin, SearchableTable} from 'sonar';
|
||||
import {FlipperPlugin, SearchableTable} from 'sonar';
|
||||
|
||||
type ID = string;
|
||||
|
||||
@@ -58,7 +58,7 @@ type Actions<T> = AppendAndUpdateAction<T> | ResetAndUpdateAction<T>;
|
||||
* the client in an unknown state.
|
||||
*/
|
||||
export function createTablePlugin<T: RowData>(props: Props<T>) {
|
||||
return class extends SonarPlugin<State<T>, Actions<T>> {
|
||||
return class extends FlipperPlugin<State<T>, Actions<T>> {
|
||||
static title = props.title;
|
||||
static id = props.id;
|
||||
static icon = props.icon;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {SonarDevicePlugin} from 'sonar';
|
||||
import {FlipperDevicePlugin} from 'sonar';
|
||||
var adb = require('adbkit-fb');
|
||||
|
||||
import {
|
||||
@@ -98,7 +98,7 @@ function formatFrequency(freq) {
|
||||
}
|
||||
}
|
||||
|
||||
export default class CPUFrequencyTable extends SonarDevicePlugin<CPUState> {
|
||||
export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
||||
static id = 'DeviceCPU';
|
||||
static title = 'CPU';
|
||||
static icon = 'underline';
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {SonarDevicePlugin} from '../plugin.js';
|
||||
import type {FlipperDevicePlugin} from '../plugin.js';
|
||||
|
||||
import {GK} from 'sonar';
|
||||
import logs from './logs/index.js';
|
||||
import cpu from './cpu/index.js';
|
||||
|
||||
const plugins: Array<Class<SonarDevicePlugin<any>>> = [logs];
|
||||
const plugins: Array<Class<FlipperDevicePlugin<any>>> = [logs];
|
||||
|
||||
if (GK.get('sonar_uiperf')) {
|
||||
plugins.push(cpu);
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
FlexColumn,
|
||||
Glyph,
|
||||
SonarSidebar,
|
||||
SonarDevicePlugin,
|
||||
FlipperDevicePlugin,
|
||||
SearchableTable,
|
||||
styled,
|
||||
} from 'sonar';
|
||||
@@ -238,7 +238,7 @@ function pad(chunk: mixed, len: number): string {
|
||||
return str;
|
||||
}
|
||||
|
||||
export default class LogTable extends SonarDevicePlugin<
|
||||
export default class LogTable extends FlipperDevicePlugin<
|
||||
State,
|
||||
Actions,
|
||||
PersistedState,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import type stream from 'stream';
|
||||
import {SonarDevicePlugin} from 'sonar';
|
||||
import {FlipperDevicePlugin} from 'sonar';
|
||||
|
||||
export type LogLevel =
|
||||
| 'unknown'
|
||||
@@ -69,7 +69,7 @@ export default class BaseDevice {
|
||||
return os.toLowerCase() === this.os.toLowerCase();
|
||||
}
|
||||
|
||||
supportsPlugin = (DevicePlugin: Class<SonarDevicePlugin<>>): boolean => {
|
||||
supportsPlugin = (DevicePlugin: Class<FlipperDevicePlugin<>>): boolean => {
|
||||
return this.supportedPlugins.includes(DevicePlugin.id);
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,11 @@ export * from './ui/index.js';
|
||||
export * from './utils/index.js';
|
||||
|
||||
export {default as GK} from './fb-stubs/GK.js';
|
||||
export {SonarBasePlugin, SonarPlugin, SonarDevicePlugin} from './plugin.js';
|
||||
export {
|
||||
FlipperBasePlugin,
|
||||
FlipperPlugin,
|
||||
FlipperDevicePlugin,
|
||||
} from './plugin.js';
|
||||
export {createTablePlugin} from './createTablePlugin.js';
|
||||
export {default as SonarSidebar} from './chrome/SonarSidebar.js';
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export type Props<T> = {
|
||||
target: PluginTarget,
|
||||
};
|
||||
|
||||
export class SonarBasePlugin<
|
||||
export class FlipperBasePlugin<
|
||||
State = *,
|
||||
Actions = *,
|
||||
PersistedState = *,
|
||||
@@ -84,7 +84,7 @@ export class SonarBasePlugin<
|
||||
}
|
||||
}
|
||||
|
||||
export class SonarDevicePlugin<S = *, A = *, P = *> extends SonarBasePlugin<
|
||||
export class FlipperDevicePlugin<S = *, A = *, P = *> extends FlipperBasePlugin<
|
||||
S,
|
||||
A,
|
||||
P,
|
||||
@@ -101,7 +101,11 @@ export class SonarDevicePlugin<S = *, A = *, P = *> extends SonarBasePlugin<
|
||||
}
|
||||
}
|
||||
|
||||
export class SonarPlugin<S = *, A = *, P = *> extends SonarBasePlugin<S, A, P> {
|
||||
export class FlipperPlugin<S = *, A = *, P = *> extends FlipperBasePlugin<
|
||||
S,
|
||||
A,
|
||||
P,
|
||||
> {
|
||||
constructor(props: Props<*>) {
|
||||
super(props);
|
||||
const {id} = this.constructor;
|
||||
|
||||
@@ -9,7 +9,7 @@ import {GK} from 'sonar';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import * as Sonar from 'sonar';
|
||||
import {SonarPlugin, SonarBasePlugin} from '../plugin.js';
|
||||
import {FlipperPlugin, FlipperBasePlugin} from '../plugin.js';
|
||||
import {remote} from 'electron';
|
||||
|
||||
const plugins = new Map();
|
||||
@@ -54,7 +54,7 @@ bundledPlugins
|
||||
}))
|
||||
.forEach(addIfNotAdded);
|
||||
|
||||
const exportedPlugins: Array<Class<SonarPlugin<>>> = Array.from(
|
||||
const exportedPlugins: Array<Class<FlipperPlugin<>>> = Array.from(
|
||||
plugins.values(),
|
||||
)
|
||||
.map(plugin => {
|
||||
@@ -78,7 +78,7 @@ const exportedPlugins: Array<Class<SonarPlugin<>>> = Array.from(
|
||||
}
|
||||
})
|
||||
.filter(Boolean)
|
||||
.filter(plugin => plugin.prototype instanceof SonarBasePlugin)
|
||||
.filter(plugin => plugin.prototype instanceof FlipperBasePlugin)
|
||||
.sort((a, b) => (a.title || '').localeCompare(b.title || ''));
|
||||
|
||||
export default exportedPlugins;
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
FlexRow,
|
||||
FlexColumn,
|
||||
Toolbar,
|
||||
SonarPlugin,
|
||||
FlipperPlugin,
|
||||
ElementsInspector,
|
||||
InspectorSidebar,
|
||||
LoadingIndicator,
|
||||
@@ -186,7 +186,7 @@ class LayoutSearchInput extends Component<
|
||||
}
|
||||
}
|
||||
|
||||
export default class Layout extends SonarPlugin<InspectorState> {
|
||||
export default class Layout extends FlipperPlugin<InspectorState> {
|
||||
static title = 'Layout';
|
||||
static id = 'Inspector';
|
||||
static icon = 'target';
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
Sidebar,
|
||||
Toolbar,
|
||||
Checkbox,
|
||||
SonarPlugin,
|
||||
FlipperPlugin,
|
||||
Button,
|
||||
styled,
|
||||
} from 'sonar';
|
||||
@@ -53,7 +53,7 @@ const ToolbarItem = styled(FlexRow)({
|
||||
marginLeft: '8px',
|
||||
});
|
||||
|
||||
export default class LeakCanary extends SonarPlugin<State> {
|
||||
export default class LeakCanary extends FlipperPlugin<State> {
|
||||
static title = 'LeakCanary';
|
||||
static id = 'LeakCanary';
|
||||
static icon = 'bird';
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
SonarSidebar,
|
||||
styled,
|
||||
} from 'sonar';
|
||||
import {SonarPlugin, SearchableTable} from 'sonar';
|
||||
import {FlipperPlugin, SearchableTable} from 'sonar';
|
||||
import RequestDetails from './RequestDetails.js';
|
||||
import {URL} from 'url';
|
||||
|
||||
@@ -109,7 +109,7 @@ const TextEllipsis = styled(Text)({
|
||||
paddingTop: 4,
|
||||
});
|
||||
|
||||
export default class extends SonarPlugin<State, *, PersistedState> {
|
||||
export default class extends FlipperPlugin<State, *, PersistedState> {
|
||||
static title = 'Network';
|
||||
static id = 'Network';
|
||||
static icon = 'internet';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {SonarPlugin} from 'sonar';
|
||||
import {FlipperPlugin} from 'sonar';
|
||||
import {FlexColumn} from 'sonar';
|
||||
import {ButtonGroup, Button, styled, colors} from 'sonar';
|
||||
|
||||
@@ -31,7 +31,7 @@ const ButtonContainer = styled(FlexColumn)({
|
||||
padding: 20,
|
||||
});
|
||||
|
||||
export default class SandboxView extends SonarPlugin<SandboxState> {
|
||||
export default class SandboxView extends FlipperPlugin<SandboxState> {
|
||||
state = {
|
||||
sandboxes: [],
|
||||
customSandbox: '',
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
DataInspector,
|
||||
styled,
|
||||
} from 'sonar';
|
||||
import {SonarPlugin} from 'sonar';
|
||||
import {FlipperPlugin} from 'sonar';
|
||||
|
||||
const {clone} = require('lodash');
|
||||
|
||||
@@ -66,7 +66,7 @@ const ChangelogColumn = styled(FlexColumn)({
|
||||
padding: '16px',
|
||||
});
|
||||
|
||||
export default class extends SonarPlugin<SharedPreferencesState> {
|
||||
export default class extends FlipperPlugin<SharedPreferencesState> {
|
||||
static title = 'Shared Preferences Viewer';
|
||||
static id = 'Preferences';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user