Plugins: better warning when plugins fail to load (#18671)

* better pluin feedback

* add server side check for module.js
This commit is contained in:
Ryan McKinley
2019-08-21 22:04:02 -07:00
committed by Torkel Ödegaard
parent c98c5c3c8e
commit f7c55d3968
6 changed files with 44 additions and 15 deletions

View File

@ -216,6 +216,17 @@ func (scanner *PluginScanner) loadPluginJson(pluginJsonFilePath string) error {
}
loader = reflect.New(reflect.TypeOf(pluginGoType)).Interface().(PluginLoader)
// External plugins need a module.js file for SystemJS to load
if !strings.HasPrefix(pluginJsonFilePath, setting.StaticRootPath) {
module := filepath.Join(filepath.Dir(pluginJsonFilePath), "module.js")
if _, err := os.Stat(module); os.IsNotExist(err) {
plog.Warn("Plugin missing module.js",
"name", pluginCommon.Name,
"warning", "Missing module.js, If you loaded this plugin from git, make sure to compile it.",
"path", module)
}
}
reader.Seek(0, 0)
return loader.Load(jsonParser, currentDir)
}