Pass real client to sidebar extension factory functions

Summary: This allows sidebar extensions to have more information as to whether they should be enabled or not

Reviewed By: danielbuechele

Differential Revision: D12930405

fbshipit-source-id: 649d3f01da1c535f7d60b7b525b012a888ea78e0
This commit is contained in:
Hilal Alsibai
2018-11-06 11:27:05 -08:00
committed by Facebook Github Bot
parent 3c3ef35bce
commit 21a18d3e53
2 changed files with 10 additions and 1 deletions

View File

@@ -1066,6 +1066,7 @@ export default class Layout extends FlipperPlugin<InspectorState> {
tooltips={this.getAccessibilityTooltips()} tooltips={this.getAccessibilityTooltips()}
onValueChanged={this.onDataValueChanged} onValueChanged={this.onDataValueChanged}
client={this.client} client={this.client}
realClient={this.realClient}
logger={this.props.logger} logger={this.props.logger}
/> />
) )
@@ -1078,6 +1079,7 @@ export default class Layout extends FlipperPlugin<InspectorState> {
element={this.state.elements[this.state.selected]} element={this.state.elements[this.state.selected]}
onValueChanged={this.onDataValueChanged} onValueChanged={this.onDataValueChanged}
client={this.client} client={this.client}
realClient={this.realClient}
logger={this.props.logger} logger={this.props.logger}
extensions={SidebarExtensions} extensions={SidebarExtensions}
/> />

View File

@@ -7,6 +7,7 @@
import type {Element} from './ElementsInspector.js'; import type {Element} from './ElementsInspector.js';
import type {PluginClient} from '../../../plugin'; import type {PluginClient} from '../../../plugin';
import type Client from '../../../Client.js';
import type Logger from '../../../fb-stubs/Logger.js'; import type Logger from '../../../fb-stubs/Logger.js';
import Panel from '../Panel.js'; import Panel from '../Panel.js';
import ManagedDataInspector from '../data-inspector/ManagedDataInspector.js'; import ManagedDataInspector from '../data-inspector/ManagedDataInspector.js';
@@ -78,6 +79,7 @@ type Props = {|
tooltips?: Object, tooltips?: Object,
onValueChanged: ?OnValueChanged, onValueChanged: ?OnValueChanged,
client: PluginClient, client: PluginClient,
realClient: Client,
logger: Logger, logger: Logger,
extensions?: Array<any>, extensions?: Array<any>,
|}; |};
@@ -119,7 +121,12 @@ export class InspectorSidebar extends Component<Props, State> {
const sections = const sections =
(extensions && (extensions &&
extensions.map(ext => extensions.map(ext =>
ext(this.props.client, element.id, this.props.logger), ext(
this.props.client,
this.props.realClient,
element.id,
this.props.logger,
),
)) || )) ||
[]; [];