From bba0ad3e0503ee5b27b9055fee41776544c5a15c Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 19 May 2021 19:29:46 -0400 Subject: [PATCH 1/5] Make session plugins get transferred to the worker properly --- packages/core/PluginLoader.ts | 12 ++++++++++-- packages/core/PluginManager.ts | 7 +++++++ packages/core/util/types/index.ts | 1 + products/jbrowse-web/src/Loader.tsx | 23 +++++++++++++++++------ products/jbrowse-web/src/rootModel.ts | 20 ++++++++++---------- products/jbrowse-web/src/rpc.worker.ts | 6 ++++-- 6 files changed, 49 insertions(+), 20 deletions(-) diff --git a/packages/core/PluginLoader.ts b/packages/core/PluginLoader.ts index ef4d3361ce..a79492f715 100644 --- a/packages/core/PluginLoader.ts +++ b/packages/core/PluginLoader.ts @@ -26,6 +26,11 @@ export interface PluginDefinition { url: string } +export interface PluginRecord { + plugin: PluginConstructor + definition: PluginDefinition +} + export default class PluginLoader { definitions: PluginDefinition[] = [] @@ -95,9 +100,12 @@ export default class PluginLoader { }) } - async load(): Promise { + async load(): Promise { return Promise.all( - this.definitions.map(definition => this.loadPlugin(definition)), + this.definitions.map(async definition => ({ + plugin: await this.loadPlugin(definition), + definition, + })), ) } } diff --git a/packages/core/PluginManager.ts b/packages/core/PluginManager.ts index 8a7163cd51..fecd3cdf94 100644 --- a/packages/core/PluginManager.ts +++ b/packages/core/PluginManager.ts @@ -32,6 +32,7 @@ import { AnyConfigurationSchemaType } from './configuration/configurationSchema' import { AbstractRootModel } from './util' import CorePlugin from './CorePlugin' import createJexlInstance from './util/jexl' +import { PluginDefinition } from './PluginLoader' /** little helper class that keeps groups of callbacks that are then run in a specified order by group */ @@ -304,6 +305,12 @@ export default class PluginManager { return this } + get pluginDefinitions(): PluginDefinition[] { + return Object.values(this.pluginMetaData) + .map(p => p.definition) + .filter(f => !!f) + } + getElementType(groupName: PluggableElementTypeGroup, typeName: string) { const typeRecord = this.getElementTypeRecord(groupName) return typeRecord.get(typeName) diff --git a/packages/core/util/types/index.ts b/packages/core/util/types/index.ts index 04f44cc29e..874c5ccd59 100644 --- a/packages/core/util/types/index.ts +++ b/packages/core/util/types/index.ts @@ -89,6 +89,7 @@ export interface AbstractSessionModel extends AbstractViewContainer { showWidget?: Function addWidget?: Function + addTrackConf?: Function DialogComponent?: DialogComponentType // eslint-disable-next-line @typescript-eslint/no-explicit-any DialogProps: any diff --git a/products/jbrowse-web/src/Loader.tsx b/products/jbrowse-web/src/Loader.tsx index aeba7e487a..e7f332cf34 100644 --- a/products/jbrowse-web/src/Loader.tsx +++ b/products/jbrowse-web/src/Loader.tsx @@ -119,6 +119,11 @@ async function checkPlugins(pluginsToCheck: { url: string }[]) { type Config = SnapshotOut +interface PluginRecord { + plugin: PluginConstructor + definition: PluginDefinition +} + const SessionLoader = types .model({ configPath: types.maybe(types.string), @@ -132,8 +137,8 @@ const SessionLoader = types shareWarningOpen: false as any, configSnapshot: undefined as any, sessionSnapshot: undefined as any, - runtimePlugins: [] as PluginConstructor[], - sessionPlugins: [] as PluginConstructor[], + runtimePlugins: [] as PluginRecord[], + sessionPlugins: [] as PluginRecord[], sessionError: undefined as Error | undefined, configError: undefined as Error | undefined, bc1: @@ -187,10 +192,10 @@ const SessionLoader = types setSessionError(error: Error) { self.sessionError = error }, - setRuntimePlugins(plugins: PluginConstructor[]) { + setRuntimePlugins(plugins: PluginRecord[]) { self.runtimePlugins = plugins }, - setSessionPlugins(plugins: PluginConstructor[]) { + setSessionPlugins(plugins: PluginRecord[]) { self.sessionPlugins = plugins }, setConfigSnapshot(snap: unknown) { @@ -494,8 +499,14 @@ const Renderer = observer( metadata: { isCore: true }, } as PluginLoadRecord }), - ...runtimePlugins.map(P => new P()), - ...sessionPlugins.map(P => new P()), + ...runtimePlugins.map(({ plugin: P, definition }) => ({ + plugin: new P(), + metadata: { definition }, + })), + ...sessionPlugins.map(({ plugin: P, definition }) => ({ + plugin: new P(), + metadata: { definition }, + })), ]) pluginManager.createPluggableElements() diff --git a/products/jbrowse-web/src/rootModel.ts b/products/jbrowse-web/src/rootModel.ts index 97748d2999..00ad1059ca 100644 --- a/products/jbrowse-web/src/rootModel.ts +++ b/products/jbrowse-web/src/rootModel.ts @@ -122,7 +122,16 @@ export default function RootModel( isDefaultSessionEditing: false, pluginsUpdated: false, }) - .volatile(() => ({ + .volatile(self => ({ + rpcManager: new RpcManager( + pluginManager, + pluginManager.pluginDefinitions, + self.jbrowse.configuration.rpc, + { + WebWorkerRpcDriver: { WorkerClass: RenderWorker }, + MainThreadRpcDriver: {}, + }, + ), savedSessionsVolatile: observable.map({}), pluginManager, error: undefined as undefined | Error, @@ -370,15 +379,6 @@ export default function RootModel( ] : []), ] as Menu[], - rpcManager: new RpcManager( - pluginManager, - getSnapshot(self.jbrowse.plugins), - self.jbrowse.configuration.rpc, - { - WebWorkerRpcDriver: { WorkerClass: RenderWorker }, - MainThreadRpcDriver: {}, - }, - ), adminMode, })) .actions(self => ({ diff --git a/products/jbrowse-web/src/rpc.worker.ts b/products/jbrowse-web/src/rpc.worker.ts index 1f6a4dc094..e98f08cf94 100644 --- a/products/jbrowse-web/src/rpc.worker.ts +++ b/products/jbrowse-web/src/rpc.worker.ts @@ -44,8 +44,10 @@ async function getPluginManager() { const pluginLoader = new PluginLoader(config.plugins) pluginLoader.installGlobalReExports(self) const runtimePlugins = await pluginLoader.load() - const plugins = [...corePlugins, ...runtimePlugins] - const pluginManager = new PluginManager(plugins.map(P => new P())) + const plugins = [...corePlugins.map(p => ({ plugin: p })), ...runtimePlugins] + const pluginManager = new PluginManager( + plugins.map(({ plugin: P }) => new P()), + ) pluginManager.createPluggableElements() pluginManager.configure() jbPluginManager = pluginManager From e3395ceb6a3bab8a0d926abebb665d19dcedf044 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 19 May 2021 19:45:53 -0400 Subject: [PATCH 2/5] Fix some tsc --- packages/core/PluginManager.ts | 2 +- products/jbrowse-desktop/src/Loader.tsx | 5 ++++- products/jbrowse-desktop/src/worker.ts | 6 ++++-- .../stories/JBrowseLinearGenomeView.stories.tsx | 6 +++--- products/jbrowse-web/src/Loader.tsx | 10 ++++------ 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/core/PluginManager.ts b/packages/core/PluginManager.ts index fecd3cdf94..e910eb6d2a 100644 --- a/packages/core/PluginManager.ts +++ b/packages/core/PluginManager.ts @@ -307,7 +307,7 @@ export default class PluginManager { get pluginDefinitions(): PluginDefinition[] { return Object.values(this.pluginMetaData) - .map(p => p.definition) + .map(p => p.definition as PluginDefinition) .filter(f => !!f) } diff --git a/products/jbrowse-desktop/src/Loader.tsx b/products/jbrowse-desktop/src/Loader.tsx index bde6b7c2de..59b4ae0954 100644 --- a/products/jbrowse-desktop/src/Loader.tsx +++ b/products/jbrowse-desktop/src/Loader.tsx @@ -80,7 +80,10 @@ export default function Loader({ plugin: new P(), metadata: { isCore: true }, })), - ...runtimePlugins.map(P => new P()), + ...runtimePlugins.map(({ plugin: P, definition }) => ({ + plugin: new P(), + metadata: { definition }, + })), ]) } catch (e) { // used to launch an error dialog for whatever caused plugin loading diff --git a/products/jbrowse-desktop/src/worker.ts b/products/jbrowse-desktop/src/worker.ts index 4d88283c0f..67cb8abac2 100644 --- a/products/jbrowse-desktop/src/worker.ts +++ b/products/jbrowse-desktop/src/worker.ts @@ -87,8 +87,10 @@ async function getPluginManager() { const pluginLoader = new PluginLoader(config.plugins) pluginLoader.installGlobalReExports(window) const runtimePlugins = await pluginLoader.load() - const plugins = [...corePlugins, ...runtimePlugins] - const pluginManager = new PluginManager(plugins.map(P => new P())) + const plugins = [...corePlugins.map(p => ({ plugin: p })), ...runtimePlugins] + const pluginManager = new PluginManager( + plugins.map(({ plugin: P }) => new P()), + ) pluginManager.createPluggableElements() pluginManager.configure() diff --git a/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx b/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx index 65def2a65a..42649dccad 100644 --- a/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx +++ b/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx @@ -1,4 +1,4 @@ -import { PluginConstructor } from '@jbrowse/core/Plugin' +import { PluginRecord } from '@jbrowse/core/PluginLoader' import React, { useEffect, useState } from 'react' import { createViewState, @@ -164,7 +164,7 @@ export const WithPlugins = () => { // const plugins = [UCSCPlugin] // alternative usage with runtime plugins - const [plugins, setPlugins] = useState() + const [plugins, setPlugins] = useState() useEffect(() => { async function getPlugins() { const loadedPlugins = await loadPlugins([ @@ -213,7 +213,7 @@ export const WithPlugins = () => { }, }, }, - plugins, + plugins: plugins.map(p => p.plugin), tracks: [ { type: 'FeatureTrack', diff --git a/products/jbrowse-web/src/Loader.tsx b/products/jbrowse-web/src/Loader.tsx index e7f332cf34..c7925218d7 100644 --- a/products/jbrowse-web/src/Loader.tsx +++ b/products/jbrowse-web/src/Loader.tsx @@ -1,7 +1,10 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import React, { lazy, useEffect, useState, Suspense } from 'react' import PluginManager, { PluginLoadRecord } from '@jbrowse/core/PluginManager' -import PluginLoader, { PluginDefinition } from '@jbrowse/core/PluginLoader' +import PluginLoader, { + PluginDefinition, + PluginRecord, +} from '@jbrowse/core/PluginLoader' import { observer } from 'mobx-react' import { inDevelopment, fromUrlSafeB64 } from '@jbrowse/core/util' import { openLocation } from '@jbrowse/core/util/io' @@ -119,11 +122,6 @@ async function checkPlugins(pluginsToCheck: { url: string }[]) { type Config = SnapshotOut -interface PluginRecord { - plugin: PluginConstructor - definition: PluginDefinition -} - const SessionLoader = types .model({ configPath: types.maybe(types.string), From e7962743d291c7befd9f81fcd6889986f753ca2a Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 20 May 2021 15:03:59 -0400 Subject: [PATCH 3/5] Small change to put plugin definition outside the plugin metadata --- packages/core/PluginManager.ts | 17 +++++++++-------- products/jbrowse-desktop/src/Loader.tsx | 2 +- products/jbrowse-web/src/Loader.tsx | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/core/PluginManager.ts b/packages/core/PluginManager.ts index e910eb6d2a..f940933228 100644 --- a/packages/core/PluginManager.ts +++ b/packages/core/PluginManager.ts @@ -138,7 +138,8 @@ type AnyFunction = (...args: any) => any export type PluginMetaData = Record export type PluginLoadRecord = { - metadata: PluginMetaData + definition?: PluginDefinition + metadata?: PluginMetaData plugin: Plugin } @@ -150,6 +151,8 @@ export default class PluginManager { pluginMetaData: Record = {} + pluginDefinitions: PluginDefinition[] = [] + elementCreationSchedule = new PhasedScheduler( 'renderer', 'adapter', @@ -205,13 +208,17 @@ export default class PluginManager { if (this.configured) { throw new Error('JBrowse already configured, cannot add plugins') } - const [plugin, metadata] = + const [plugin, metadata = {}] = load instanceof Plugin ? [load, {}] : [load.plugin, load.metadata] if (this.plugins.includes(plugin)) { throw new Error('plugin already installed') } + this.pluginMetaData[plugin.name] = metadata + if ('definition' in load && load.definition) { + this.pluginDefinitions.push(load.definition) + } plugin.install(this) this.plugins.push(plugin) return this @@ -305,12 +312,6 @@ export default class PluginManager { return this } - get pluginDefinitions(): PluginDefinition[] { - return Object.values(this.pluginMetaData) - .map(p => p.definition as PluginDefinition) - .filter(f => !!f) - } - getElementType(groupName: PluggableElementTypeGroup, typeName: string) { const typeRecord = this.getElementTypeRecord(groupName) return typeRecord.get(typeName) diff --git a/products/jbrowse-desktop/src/Loader.tsx b/products/jbrowse-desktop/src/Loader.tsx index 59b4ae0954..ce05cf0fe8 100644 --- a/products/jbrowse-desktop/src/Loader.tsx +++ b/products/jbrowse-desktop/src/Loader.tsx @@ -82,7 +82,7 @@ export default function Loader({ })), ...runtimePlugins.map(({ plugin: P, definition }) => ({ plugin: new P(), - metadata: { definition }, + definition, })), ]) } catch (e) { diff --git a/products/jbrowse-web/src/Loader.tsx b/products/jbrowse-web/src/Loader.tsx index c7925218d7..3a581d3a25 100644 --- a/products/jbrowse-web/src/Loader.tsx +++ b/products/jbrowse-web/src/Loader.tsx @@ -499,11 +499,11 @@ const Renderer = observer( }), ...runtimePlugins.map(({ plugin: P, definition }) => ({ plugin: new P(), - metadata: { definition }, + definition, })), ...sessionPlugins.map(({ plugin: P, definition }) => ({ plugin: new P(), - metadata: { definition }, + definition, })), ]) pluginManager.createPluggableElements() From ac42aeda938f24adcd919b18209aa762a46abc40 Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 21 May 2021 13:01:06 -0400 Subject: [PATCH 4/5] Explicitly call the plugin definitions runtimePluginDefinitions --- packages/core/Plugin.ts | 4 ++ packages/core/PluginManager.ts | 22 +++++---- .../components/AboutWidget.test.js | 24 +++++++++- .../AboutWidget/components/AboutWidget.tsx | 48 ++++++------------- .../__snapshots__/AboutWidget.test.js.snap | 20 +++++++- products/jbrowse-web/src/rootModel.ts | 1 - 6 files changed, 73 insertions(+), 46 deletions(-) diff --git a/packages/core/Plugin.ts b/packages/core/Plugin.ts index 2eed30a318..2755a99006 100644 --- a/packages/core/Plugin.ts +++ b/packages/core/Plugin.ts @@ -7,6 +7,10 @@ import { AnyConfigurationSchemaType } from './configuration/configurationSchema' export default abstract class Plugin { abstract name: string + url?: string + + version?: string + install(_pluginManager: PluginManager): void {} configure(_pluginManager: PluginManager): void {} diff --git a/packages/core/PluginManager.ts b/packages/core/PluginManager.ts index f940933228..e3279e3ca9 100644 --- a/packages/core/PluginManager.ts +++ b/packages/core/PluginManager.ts @@ -135,13 +135,15 @@ type AnyFunction = (...args: any) => any * Can also use this metadata to stash other things about why the plugin is * loaded, such as where it came from, what plugin depends on it, etc. */ -export type PluginMetaData = Record +export type PluginMetadata = Record -export type PluginLoadRecord = { - definition?: PluginDefinition - metadata?: PluginMetaData +export interface PluginLoadRecord { + metadata?: PluginMetadata plugin: Plugin } +export interface RuntimePluginLoadRecord extends PluginLoadRecord { + definition: PluginDefinition +} export default class PluginManager { plugins: Plugin[] = [] @@ -149,9 +151,9 @@ export default class PluginManager { // eslint-disable-next-line @typescript-eslint/no-explicit-any jexl: any = createJexlInstance() - pluginMetaData: Record = {} + pluginMetadata: Record = {} - pluginDefinitions: PluginDefinition[] = [] + runtimePluginDefinitions: PluginDefinition[] = [] elementCreationSchedule = new PhasedScheduler( 'renderer', @@ -204,7 +206,7 @@ export default class PluginManager { return configurationSchemas } - addPlugin(load: Plugin | PluginLoadRecord) { + addPlugin(load: Plugin | PluginLoadRecord | RuntimePluginLoadRecord) { if (this.configured) { throw new Error('JBrowse already configured, cannot add plugins') } @@ -215,9 +217,9 @@ export default class PluginManager { throw new Error('plugin already installed') } - this.pluginMetaData[plugin.name] = metadata - if ('definition' in load && load.definition) { - this.pluginDefinitions.push(load.definition) + this.pluginMetadata[plugin.name] = metadata + if ('definition' in load) { + this.runtimePluginDefinitions.push(load.definition) } plugin.install(this) this.plugins.push(plugin) diff --git a/plugins/menus/src/AboutWidget/components/AboutWidget.test.js b/plugins/menus/src/AboutWidget/components/AboutWidget.test.js index a7f77b621c..68807716fc 100644 --- a/plugins/menus/src/AboutWidget/components/AboutWidget.test.js +++ b/plugins/menus/src/AboutWidget/components/AboutWidget.test.js @@ -1,10 +1,32 @@ import React from 'react' import { render } from '@testing-library/react' import AboutWidget from './AboutWidget' +import { types } from 'mobx-state-tree' +import { ConfigurationSchema } from '@jbrowse/core/configuration' describe('', () => { it('renders', () => { - const { container } = render() + const session = types + .model({ + configuration: ConfigurationSchema('Null', {}), + rpcManager: types.frozen({}), + }) + .create( + {}, + { + pluginManager: { + pluginMetadata: {}, + plugins: [ + { + name: 'HelloPlugin', + version: '1.0.0', + url: 'http://google.com', + }, + ], + }, + }, + ) + const { container } = render() expect(container.firstChild).toMatchSnapshot() }) }) diff --git a/plugins/menus/src/AboutWidget/components/AboutWidget.tsx b/plugins/menus/src/AboutWidget/components/AboutWidget.tsx index c867d636a1..2b640bf182 100644 --- a/plugins/menus/src/AboutWidget/components/AboutWidget.tsx +++ b/plugins/menus/src/AboutWidget/components/AboutWidget.tsx @@ -3,7 +3,7 @@ import { observer } from 'mobx-react' import { IAnyStateTreeNode, getEnv } from 'mobx-state-tree' import { getSession } from '@jbrowse/core/util' import { makeStyles, Typography, Link } from '@material-ui/core' -import { PluginMetaData } from '@jbrowse/core/PluginManager' +import PluginManager from '@jbrowse/core/PluginManager' const useStyles = makeStyles(theme => ({ root: { @@ -19,46 +19,28 @@ const useStyles = makeStyles(theme => ({ }, })) -interface BasePlugin { - version?: string - name: string - url?: string -} - function About({ model }: { model: IAnyStateTreeNode }) { const classes = useStyles() - const slotDefinition = { - version: '', - pluginManager: { - plugins: [], - pluginMetaData: {} as Record, - }, - } - const { pluginManager } = model ? getEnv(model) : slotDefinition - const { plugins } = pluginManager + const { version } = getSession(model) + const { pluginManager } = getEnv(model) + const { plugins } = pluginManager as PluginManager const corePlugins = plugins - .filter((p: BasePlugin) => - Boolean(pluginManager.pluginMetaData[p.name]?.isCore), - ) - .map((p: BasePlugin) => p.name) + .filter(p => pluginManager.pluginMetadata[p.name]?.isCore) + .map(p => p.name) const corePluginsRender = plugins - .filter((plugin: BasePlugin) => { + .filter(plugin => { return corePlugins.includes(plugin.name) }) - .map((plugin: BasePlugin) => { - return ( -
  • - {plugin.name} {plugin.version || ''} -
  • - ) - }) + .map(plugin => ( +
  • + {plugin.name} {plugin.version || ''} +
  • + )) const externalPluginsRender = plugins - .filter((plugin: BasePlugin) => { - return !corePlugins.includes(plugin.name) - }) - .map((plugin: BasePlugin) => { + .filter(plugin => !corePlugins.includes(plugin.name)) + .map(plugin => { const text = `${plugin.name} ${plugin.version || ''}` return (
  • @@ -79,7 +61,7 @@ function About({ model }: { model: IAnyStateTreeNode }) { JBrowse 2 - {model ? getSession(model).version : slotDefinition.version} + {version} JBrowse is a{' '} diff --git a/plugins/menus/src/AboutWidget/components/__snapshots__/AboutWidget.test.js.snap b/plugins/menus/src/AboutWidget/components/__snapshots__/AboutWidget.test.js.snap index 1cecc25272..8da70227a1 100644 --- a/plugins/menus/src/AboutWidget/components/__snapshots__/AboutWidget.test.js.snap +++ b/plugins/menus/src/AboutWidget/components/__snapshots__/AboutWidget.test.js.snap @@ -36,6 +36,24 @@ exports[` renders 1`] = `

    + > +
    + External plugins loaded +
    + +
    `; diff --git a/products/jbrowse-web/src/rootModel.ts b/products/jbrowse-web/src/rootModel.ts index 00ad1059ca..e3ca17f016 100644 --- a/products/jbrowse-web/src/rootModel.ts +++ b/products/jbrowse-web/src/rootModel.ts @@ -125,7 +125,6 @@ export default function RootModel( .volatile(self => ({ rpcManager: new RpcManager( pluginManager, - pluginManager.pluginDefinitions, self.jbrowse.configuration.rpc, { WebWorkerRpcDriver: { WorkerClass: RenderWorker }, From 7190f2b72606f3b1916cf186c117f646e6630a18 Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 21 May 2021 13:02:52 -0400 Subject: [PATCH 5/5] Rename to PluginManager.runtimePluginDefinitions instead of PluginManager.pluginDefinitions for clarity --- packages/core/rpc/RpcManager.ts | 6 +--- .../components/InstalledPluginsList.tsx | 32 ++++++++----------- products/jbrowse-desktop/src/rootModel.ts | 1 - .../src/createModel/createModel.ts | 11 ++----- 4 files changed, 18 insertions(+), 32 deletions(-) diff --git a/packages/core/rpc/RpcManager.ts b/packages/core/rpc/RpcManager.ts index ca240f7b1d..dcba7f1ed7 100644 --- a/packages/core/rpc/RpcManager.ts +++ b/packages/core/rpc/RpcManager.ts @@ -40,11 +40,8 @@ export default class RpcManager { backendConfigurations: BackendConfigurations - runtimePluginDefinitions: PluginDefinition[] - constructor( pluginManager: PluginManager, - runtimePluginDefinitions: PluginDefinition[] = [], mainConfiguration: AnyConfigurationModel, backendConfigurations: BackendConfigurations, ) { @@ -52,7 +49,6 @@ export default class RpcManager { throw new Error('RpcManager requires at least a main configuration') } this.pluginManager = pluginManager - this.runtimePluginDefinitions = runtimePluginDefinitions this.mainConfiguration = mainConfiguration this.backendConfigurations = backendConfigurations this.driverObjects = new Map() @@ -74,7 +70,7 @@ export default class RpcManager { } // eslint-disable-next-line @typescript-eslint/no-explicit-any const newDriver = new DriverClassImpl(backendConfiguration as any, { - plugins: this.runtimePluginDefinitions, + plugins: this.pluginManager.runtimePluginDefinitions, }) this.driverObjects.set(backendName, newDriver) return newDriver diff --git a/plugins/data-management/src/PluginStoreWidget/components/InstalledPluginsList.tsx b/plugins/data-management/src/PluginStoreWidget/components/InstalledPluginsList.tsx index 708d14c700..2e8c07ddb4 100644 --- a/plugins/data-management/src/PluginStoreWidget/components/InstalledPluginsList.tsx +++ b/plugins/data-management/src/PluginStoreWidget/components/InstalledPluginsList.tsx @@ -17,30 +17,26 @@ function InstalledPluginsList({ pluginManager: PluginManager model: PluginStoreModel }) { - const { plugins } = pluginManager + const { plugins } = pluginManager as PluginManager const corePlugins = plugins - .filter((p: BasePlugin) => - Boolean(pluginManager.pluginMetaData[p.name]?.isCore), - ) - .map((p: BasePlugin) => p.name) - - const externalPlugins = plugins.filter((plugin: BasePlugin) => { - return !corePlugins.includes(plugin.name) - }) - - const externalPluginsRender = externalPlugins - .filter((plugin: BasePlugin) => { - return plugin.name.toLowerCase().includes(model.filterText.toLowerCase()) - }) - .map((plugin: BasePlugin) => { - return - }) + .filter(p => pluginManager.pluginMetadata[p.name]?.isCore) + .map(p => p.name) + + const externalPlugins = plugins.filter( + plugin => !corePlugins.includes(plugin.name), + ) return ( {externalPlugins.length ? ( - externalPluginsRender + externalPlugins + .filter(plugin => + plugin.name.toLowerCase().includes(model.filterText.toLowerCase()), + ) + .map(plugin => ( + + )) ) : ( No plugins currently installed )} diff --git a/products/jbrowse-desktop/src/rootModel.ts b/products/jbrowse-desktop/src/rootModel.ts index 021a7f4e2c..52a002744b 100644 --- a/products/jbrowse-desktop/src/rootModel.ts +++ b/products/jbrowse-desktop/src/rootModel.ts @@ -140,7 +140,6 @@ export default function RootModel(pluginManager: PluginManager) { ] as Menu[], rpcManager: new RpcManager( pluginManager, - getSnapshot(self.jbrowse.plugins), self.jbrowse.configuration.rpc, { ElectronRpcDriver: { workerCreationChannel: 'createWindowWorker' }, diff --git a/products/jbrowse-react-linear-genome-view/src/createModel/createModel.ts b/products/jbrowse-react-linear-genome-view/src/createModel/createModel.ts index 1fc9d440c4..63d3797cd3 100644 --- a/products/jbrowse-react-linear-genome-view/src/createModel/createModel.ts +++ b/products/jbrowse-react-linear-genome-view/src/createModel/createModel.ts @@ -54,14 +54,9 @@ export default function createModel(runtimePlugins: PluginConstructor[]) { }, })) .volatile(self => ({ - rpcManager: new RpcManager( - pluginManager, - // don't need runtimePluginDefinitions since MainThreadRpcDriver doesn't - // use them - [], - self.config.configuration.rpc, - { MainThreadRpcDriver: {} }, - ), + rpcManager: new RpcManager(pluginManager, self.config.configuration.rpc, { + MainThreadRpcDriver: {}, + }), })) return { model: rootModel, pluginManager } }