RFC NT Layout sidebar extension

Summary:
This diff is not meant to land as-is, but instead to generate discussion on how to properly accomplish this.

The goal is to add a Layout plugin sidebar extension that displays the NT reduction trace when an NT component is selected.

Note this is a feature that exists today (when whitelisted on `reduction_trace_check` GK) via the `SKComponentLayoutDescriptor` API, where we'd include the entire JSON representation on every element and display that in a standard inspector in the sidebar. We have a new metadata system where we only include a metadata id and Flipper can separately request the metadata, which is much more performant. Also, we have an existing `NTReductionTracePanel` component we'd like to use that handles requesting and displaying that information in a much better way.

I'd still like to use the `SKComponentLayoutDescriptor` API (or something similar) to have access to that component's metadata id in order to decide whether the panel should appear and of course that id is needed for the panel. This works well right now (see test plan), but as you can see, it's less than ideal in that it needs to look into `Extra Sections` then `Native Templates` to get that information. This might be acceptable for the time being while we think this API through, but I wanted to get input on if we can do better before trying to land.

Additional questions:
- Why are `SidebarExtensions` exported from the "flipper" module, when they only work with and import from the Layout plugin?
- There are two `InspectorSidebar` components - one in the Layout plugin and one in main flipper module [here](https://fburl.com/diffusion/ecg8lhfq) that I don't think is being used?

Reviewed By: mweststrate

Differential Revision: D21887701

fbshipit-source-id: 23ed19c08b68b4b1115b8cc6af84af9e87e91128
This commit is contained in:
Scott Kyle
2020-06-12 09:46:40 -07:00
committed by Facebook GitHub Bot
parent fb92a6f131
commit 906b6a0230

View File

@@ -44,7 +44,6 @@ export {getPluginKey, getPersistedState} from './utils/pluginUtils';
export {Idler} from './utils/Idler'; export {Idler} from './utils/Idler';
export {Store, MiddlewareAPI, State as ReduxState} from './reducers/index'; export {Store, MiddlewareAPI, State as ReduxState} from './reducers/index';
export {default as BaseDevice} from './devices/BaseDevice'; export {default as BaseDevice} from './devices/BaseDevice';
export {default as SidebarExtensions} from './fb-stubs/LayoutInspectorSidebarExtensions';
export { export {
DeviceLogListener, DeviceLogListener,
DeviceLogEntry, DeviceLogEntry,
@@ -190,3 +189,6 @@ export {Logger} from './fb-interfaces/Logger';
export {getInstance as getLogger} from './fb-stubs/Logger'; export {getInstance as getLogger} from './fb-stubs/Logger';
export {callVSCode, getVSCodeUrl} from './utils/vscodeUtils'; export {callVSCode, getVSCodeUrl} from './utils/vscodeUtils';
export {useLocalStorage} from './utils/useLocalStorage'; export {useLocalStorage} from './utils/useLocalStorage';
// Sidebar extensions should be last so they can import anything from here.
export {default as SidebarExtensions} from './fb-stubs/LayoutInspectorSidebarExtensions';