@@ -29,8 +29,6 @@ define([
2929 IdentityProvider ,
3030 MCWSPersistenceProviderPlugin
3131) {
32- const ALLOWED_OPTIONAL_PLUGINS = [ 'BarChart' ] ;
33-
3432 function loader ( config ) {
3533 let persistenceLoaded ;
3634 const persistenceLoadedPromise = new Promise ( ( resolve ) => {
@@ -124,30 +122,17 @@ define([
124122 openmct . install ( openmct . plugins . SummaryWidget ( ) ) ;
125123 }
126124
127- const pluginErrors = [ ] ;
128- const pluginsToInstall = Object . entries ( config . plugins ) . filter ( ( [ plugin , pluginConfig ] ) => {
129- const isSummaryWidget = plugin === 'summaryWidgets' ;
130- const allowedPlugin = ALLOWED_OPTIONAL_PLUGINS . includes ( plugin ) ;
125+ Object . entries ( config . plugins ) . forEach ( ( [ plugin , pluginConfig ] ) => {
126+ const pluginExists = openmct . plugins [ plugin ] || openmct . plugins . example [ plugin ] ;
131127 const pluginEnabled = pluginConfig ?. enabled ;
128+ const isSummaryWidget = plugin === 'summaryWidgets' ;
129+ const installPlugin = pluginExists && pluginEnabled && ! isSummaryWidget ;
132130
133- if ( ! allowedPlugin && ! isSummaryWidget ) {
134- pluginErrors . push ( plugin ) ;
131+ if ( installPlugin ) {
132+ openmct . install ( openmct . plugins [ plugin ] ( ...( pluginConfig . configuration ?? [ ] ) ) ) ;
133+ } else if ( ! pluginExists ) {
134+ console . warn ( `Plugin ${ plugin } does not exist. Check the plugin name and try again.` ) ;
135135 }
136-
137- return allowedPlugin && pluginEnabled && ! isSummaryWidget ;
138- } ) ;
139-
140- // Warn if any plugins are not supported
141- if ( pluginErrors . length > 0 ) {
142- console . warn (
143- `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 ( ', ' ) } `
144- ) ;
145- }
146-
147- pluginsToInstall . forEach ( ( [ plugin , pluginConfig ] ) => {
148- const { configuration = [ ] } = pluginConfig ;
149-
150- openmct . install ( openmct . plugins [ plugin ] ( ...configuration ) ) ;
151136 } ) ;
152137 }
153138
0 commit comments