Skip to content
Snippets Groups Projects
Commit 2f65168d authored by Xiao Gui's avatar Xiao Gui
Browse files

chore: standardise launch widget with pluginState

parent 66c57cd8
No related branches found
No related tags found
No related merge requests found
......@@ -32,13 +32,7 @@ export class PluginServices{
){
this.pluginUnitFactory = this.cfr.resolveComponentFactory( PluginUnit )
this.apiService.interactiveViewer.uiHandle.launchNewWidget = (manifest) => this.launchPlugin(manifest)
.then(handler => {
this.orphanPlugins.add(manifest)
handler.onShutdown(() => {
this.orphanPlugins.delete(manifest)
})
})
this.apiService.interactiveViewer.uiHandle.launchNewWidget = this.launchNewWidget.bind(this)
this.atlasDataService.promiseFetchedPluginManifests
......@@ -47,6 +41,14 @@ export class PluginServices{
.catch(console.error)
}
launchNewWidget = (manifest) => this.launchPlugin(manifest)
.then(handler => {
this.orphanPlugins.add(manifest)
handler.onShutdown(() => {
this.orphanPlugins.delete(manifest)
})
})
readyPlugin(plugin:PluginManifest):Promise<any>{
return Promise.all([
isDefined(plugin.template) ?
......
......@@ -182,7 +182,7 @@ export class AtlasViewerURLService{
const pluginStates = searchparams.get('pluginStates')
if(pluginStates){
const arrPluginStates = pluginStates.split('__')
arrPluginStates.forEach(url => fetch(url).then(res => res.json()).then(json => this.pluginService.launchPlugin(json)).catch(console.error))
arrPluginStates.forEach(url => fetch(url).then(res => res.json()).then(json => this.pluginService.launchNewWidget(json)).catch(console.error))
}
})
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment