Change PluginContainer to allow selecting unavailable plugins
Summary: Changed PluginContainer implementation to allow selecting unavailable/uninstalled plugins which was impossible before that. Please note that for now something is shown only for enabled and disabled plugins. In next diff I'm also adding content for unavailable and uninstalled plugins. Reviewed By: mweststrate Differential Revision: D29254788 fbshipit-source-id: da639e5efddc821061abb69df534ffdce8ccd4e0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ff5d8ba29f
commit
e36eec82b2
@@ -7,33 +7,16 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
PluginDetails,
|
||||
DownloadablePluginDetails,
|
||||
BundledPluginDetails,
|
||||
} from 'flipper-plugin-lib';
|
||||
import MetroDevice from '../devices/MetroDevice';
|
||||
import {
|
||||
DevicePluginDefinition,
|
||||
ClientPluginDefinition,
|
||||
PluginDefinition,
|
||||
} from '../plugin';
|
||||
import {State} from '../reducers';
|
||||
import {
|
||||
computePluginLists,
|
||||
computeExportablePlugins,
|
||||
computeActivePluginList,
|
||||
} from '../utils/pluginUtils';
|
||||
import createSelector from './createSelector';
|
||||
|
||||
export type PluginLists = {
|
||||
devicePlugins: DevicePluginDefinition[];
|
||||
metroPlugins: DevicePluginDefinition[];
|
||||
enabledPlugins: ClientPluginDefinition[];
|
||||
disabledPlugins: PluginDefinition[];
|
||||
unavailablePlugins: [plugin: PluginDetails, reason: string][];
|
||||
downloadablePlugins: (DownloadablePluginDetails | BundledPluginDetails)[];
|
||||
};
|
||||
|
||||
const getSelectedPluginId = (state: State) => state.connections.selectedPlugin;
|
||||
const getSelectedApp = (state: State) =>
|
||||
state.connections.selectedApp || state.connections.userPreferredApp;
|
||||
const getSelectedDevice = (state: State) => state.connections.selectedDevice;
|
||||
@@ -135,3 +118,18 @@ export const getExportablePlugins = createSelector(
|
||||
getPluginLists,
|
||||
computeExportablePlugins,
|
||||
);
|
||||
export const getActivePluginList = createSelector(
|
||||
getPluginLists,
|
||||
computeActivePluginList,
|
||||
);
|
||||
|
||||
export const getActivePlugin = createSelector(
|
||||
getSelectedPluginId,
|
||||
getActivePluginList,
|
||||
(pluginId, pluginList) => {
|
||||
if (!pluginId) {
|
||||
return null;
|
||||
}
|
||||
return pluginList[pluginId] ?? null;
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user