diff --git a/config.js b/config.js index 4f5672f..0ef431a 100644 --- a/config.js +++ b/config.js @@ -374,19 +374,23 @@ * Plugin Support * Example configuration: * plugins: { - // Simple enable + // Simple enable: + // openmct.plugins.anotherPlugin() anotherPlugin: { enabled: true }, - // Enable with options - configuredPlugin: { + // Enable with options: + // openmct.plugins.ConfiguredPlugin({setting1: 'value1', setting2: 'value2'}, 1000) + // 1000 is passed as the second argument to the plugin constructor + ConfiguredPlugin: { enabled: true, // these are passed as arguments to the plugin constructor configuration: [ { setting1: 'value1', setting2: 'value2' - } + }, + 1000 ] } } @@ -400,6 +404,25 @@ }, BarChart: { enabled: false + }, + ScatterPlot: { + enabled: false + }, + Timeline: { + enabled: false + }, + Timelist: { + enabled: false + }, + PlanLayout: { + enabled: false, + configuration: [ + { + name: 'Gantt Chart', + creatable: true, + namespace: '' // namespace to use for the activity state object + } + ] } }, diff --git a/loader.js b/loader.js index 0f8b81f..d1394d3 100644 --- a/loader.js +++ b/loader.js @@ -29,8 +29,6 @@ define([ IdentityProvider, MCWSPersistenceProviderPlugin ) { - const ALLOWED_OPTIONAL_PLUGINS = ['BarChart']; - function loader(config) { let persistenceLoaded; const persistenceLoadedPromise = new Promise((resolve) => { @@ -124,30 +122,17 @@ define([ openmct.install(openmct.plugins.SummaryWidget()); } - const pluginErrors = []; - const pluginsToInstall = Object.entries(config.plugins).filter(([plugin, pluginConfig]) => { - const isSummaryWidget = plugin === 'summaryWidgets'; - const allowedPlugin = ALLOWED_OPTIONAL_PLUGINS.includes(plugin); + Object.entries(config.plugins).forEach(([plugin, pluginConfig]) => { + const pluginExists = openmct.plugins[plugin] || openmct.plugins.example[plugin]; const pluginEnabled = pluginConfig?.enabled; + const isSummaryWidget = plugin === 'summaryWidgets'; + const installPlugin = pluginExists && pluginEnabled && !isSummaryWidget; - if (!allowedPlugin && !isSummaryWidget) { - pluginErrors.push(plugin); + if (installPlugin) { + openmct.install(openmct.plugins[plugin](...(pluginConfig.configuration ?? []))); + } else if (!pluginExists) { + console.warn(`Plugin ${plugin} does not exist. Check the plugin name and try again.`); } - - return allowedPlugin && pluginEnabled && !isSummaryWidget; - }); - - // Warn if any plugins are not supported - if (pluginErrors.length > 0) { - console.warn( - `Unable to install plugins: ${pluginErrors.join(', ')}. Please verify the plugin name is correct and is included in the supported plugins list. Available plugins: ${ALLOWED_OPTIONAL_PLUGINS.join(', ')}` - ); - } - - pluginsToInstall.forEach(([plugin, pluginConfig]) => { - const { configuration = [] } = pluginConfig; - - openmct.install(openmct.plugins[plugin](...configuration)); }); } diff --git a/package.json b/package.json index 02b98c5..181f7cf 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "mini-css-extract-plugin": "2.7.6", "moment": "2.30.1", "node-bourbon": "^4.2.3", - "openmct": "github:nasa/openmct#omm-release/5.4.0", + "openmct": "github:nasa/openmct#omm-r5.4.0-rc1", "prettier": "3.4.2", "printj": "1.3.1", "raw-loader": "^0.5.1",