Merge pull request #4620 from node-red/pr_4387

Add support for plugin (only) modules to the palette manager
This commit is contained in:
Nick O'Leary
2024-03-28 14:35:33 +00:00
committed by GitHub
18 changed files with 482 additions and 153 deletions

View File

@@ -65,6 +65,25 @@ var api = module.exports = {
runtime.log.audit({event: "plugins.configs.get"}, opts.req);
return runtime.plugins.getPluginConfigs(opts.lang);
},
/**
* Gets the editor content for one registered plugin
* @param {Object} opts
* @param {User} opts.user - the user calling the api
* @param {User} opts.user - the user calling the api
* @param {Object} opts.req - the request to log (optional)
* @return {Promise<NodeInfo>} - the plugin information
* @memberof @node-red/runtime_plugins
*/
getPluginConfig: async function(opts) {
if (/[^0-9a-z=\-\*]/i.test(opts.lang)) {
throw new Error("Invalid language: "+opts.lang)
return;
}
runtime.log.audit({event: "plugins.configs.get"}, opts.req);
return runtime.plugins.getPluginConfig(opts.module, opts.lang);
},
/**
* Gets all registered module message catalogs
* @param {Object} opts

View File

@@ -173,7 +173,11 @@ function installModule(module,version,url) {
if (info.pending_version) {
events.emit("runtime-event",{id:"node/upgraded",retain:false,payload:{module:info.name,version:info.pending_version}});
} else {
events.emit("runtime-event",{id:"node/added",retain:false,payload:info.nodes});
if (!info.nodes.length && info.plugins.length) {
events.emit("runtime-event",{id:"plugin/added",retain:false,payload:info.plugins});
} else {
events.emit("runtime-event",{id:"node/added",retain:false,payload:info.nodes});
}
}
return info;
});

View File

@@ -7,5 +7,6 @@ module.exports = {
getPluginsByType: registry.getPluginsByType,
getPluginList: registry.getPluginList,
getPluginConfigs: registry.getPluginConfigs,
getPluginConfig: registry.getPluginConfig,
exportPluginSettings: registry.exportPluginSettings
}