diff --git a/src/app/components/side-panel.js b/src/app/components/side-panel.js index 604a9521a6..a4a5e23245 100644 --- a/src/app/components/side-panel.js +++ b/src/app/components/side-panel.js @@ -127,7 +127,7 @@ export class SidePanel extends AbstractPanel { } } - const header = yo` + const header = yo`
${name}
${docLink} diff --git a/src/app/panels/tab-proxy.js b/src/app/panels/tab-proxy.js index 47e8e715a5..8328e0957f 100644 --- a/src/app/panels/tab-proxy.js +++ b/src/app/panels/tab-proxy.js @@ -49,25 +49,24 @@ export class TabProxy { }) }) - appManager.event.on('activate', (name) => { - const { profile } = appManager.getPlugin(name) + appManager.event.on('activate', (profile) => { if (profile.location === 'mainPanel') { this.addTab( - name, + profile.name, profile.displayName, - () => this.event.emit('switchApp', name), + () => this.event.emit('switchApp', profile.name), () => { - this.event.emit('closeApp', name) - this.appManager.deactivatePlugin(name) + this.event.emit('closeApp', profile.name) + this.appManager.deactivatePlugin(profile.name) }, profile.icon ) - this.switchTab(name) + this.switchTab(profile.name) } }) - appManager.event.on('deactivate', (name) => { - this.removeTab(name) + appManager.event.on('deactivate', (profile) => { + this.removeTab(profile.name) }) appManager.event.on('ensureActivated', (name) => { diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 28bc2ba059..62d10fe28b 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -30,11 +30,11 @@ module.exports = class TestTab extends ViewPlugin { this.appManager = appManager this.renderer = renderer this.baseurl = 'https://solc-bin.ethereum.org/bin' - appManager.event.on('activate', (name) => { - if (name === 'solidity') this.updateRunAction(fileManager.currentFile()) + appManager.event.on('activate', (profile) => { + if (profile.name === 'solidity') this.updateRunAction(fileManager.currentFile()) }) - appManager.event.on('deactivate', (name) => { - if (name === 'solidity') this.updateRunAction(fileManager.currentFile()) + appManager.event.on('deactivate', (profile) => { + if (profile.name === 'solidity') this.updateRunAction(fileManager.currentFile()) }) } diff --git a/src/app/ui/auto-complete-popup.js b/src/app/ui/auto-complete-popup.js index f9284fc6cb..9a472c503d 100644 --- a/src/app/ui/auto-complete-popup.js +++ b/src/app/ui/auto-complete-popup.js @@ -189,13 +189,12 @@ class AutoCompletePopup { extendAutocompletion () { // TODO: this is not using the appManager interface. Terminal should be put as module - this.opts.appManager.event.on('activate', async (id) => { - const profile = await this.opts.appManager.getProfile(id) + this.opts.appManager.event.on('activate', async (profile) => { if (!profile.methods) return profile.methods.forEach((method) => { - const key = `remix.call({name: '${id}', key:'${method}', payload: []}).then((result) => { console.log(result) }).catch((error) => { console.log(error) })` + const key = `remix.call({name: '${profile.name}', key:'${method}', payload: []}).then((result) => { console.log(result) }).catch((error) => { console.log(error) })` const keyValue = {} - keyValue[key] = `call ${id} - ${method}` + keyValue[key] = `call ${profile.name} - ${method}` if (this.extraCommands.includes(keyValue)) return this.extraCommands.push(keyValue) }) diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 21822642ac..2432934043 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -8,7 +8,7 @@ const requiredModules = [ // services + layout views + system views 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', 'fileExplorers', 'terminal', 'settings', 'pluginManager'] -export function isNative (name) { +export function isNative (name) { const nativePlugins = ['vyper', 'workshops', 'ethdoc', 'etherscan'] return nativePlugins.includes(name) || requiredModules.includes(name) } @@ -36,9 +36,9 @@ export class RemixAppManager extends PluginManager { return true } - onActivated (plugin) { + onPluginActivated (plugin) { this.pluginLoader.set(plugin, this.actives) - this.event.emit('activate', plugin.name) + this.event.emit('activate', plugin) } getAll () { @@ -51,9 +51,9 @@ export class RemixAppManager extends PluginManager { return Object.keys(this.registered) } - onDeactivated (plugin) { + onPluginDeactivated (plugin) { this.pluginLoader.set(plugin, this.actives) - this.event.emit('deactivate', plugin.name) + this.event.emit('deactivate', plugin) } onRegistration (plugin) { @@ -62,6 +62,16 @@ export class RemixAppManager extends PluginManager { this.event.emit('added', plugin.name) } + ensureActivated (apiName) { + if (!this.isActive(apiName)) this.activateOne(apiName) + this.event.emit('ensureActivated', apiName) + } + + ensureDeactivated (apiName) { + if (this.isActive(apiName)) this.deactivateOne(apiName) + this.event.emit('ensureDeactivated', apiName) + } + deactivatePlugin (name) { if (requiredModules.includes(name)) return super.deactivatePlugin(name)