diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index 02194a9b1d..9fc4961813 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -87,35 +87,32 @@ class PluginManagerComponent extends ViewPlugin { this.appManager.event.on('added', () => { this.reRender() }) } - renderItem (name) { - const api = this.appManager.getPlugin(name) - if (!api) return - const isActive = this.appManager.isActive(name) - const displayName = (api.profile.displayName) ? api.profile.displayName : name + renderItem (profile, isActive) { + const displayName = (profile.displayName) ? profile.displayName : profile.name // Check version of the plugin let versionWarning // Alpha - if (api.profile.version && api.profile.version.match(/\b(\w*alpha\w*)\b/g)) { + if (profile.version && profile.version.match(/\b(\w*alpha\w*)\b/g)) { versionWarning = yo`alpha` } // Beta - if (api.profile.version && api.profile.version.match(/\b(\w*beta\w*)\b/g)) { + if (profile.version && profile.version.match(/\b(\w*beta\w*)\b/g)) { versionWarning = yo`beta` } const activationButton = isActive ? yo` - ` : yo` - ` return yo` -
+
${displayName} @@ -123,7 +120,7 @@ class PluginManagerComponent extends ViewPlugin {
${activationButton}
-

${api.profile.description}

+

${profile.description}

` } @@ -154,25 +151,26 @@ class PluginManagerComponent extends ViewPlugin { render () { // Filtering helpers - const isFiltered = (api) => (api.profile.displayName ? api.profile.displayName : api.name).toLowerCase().includes(this.filter) - const isNotRequired = ({profile}) => !this.appManager.isRequired(profile.name) - const isNotHome = ({profile}) => profile.name !== 'home' - const sortByName = (a, b) => { - const nameA = ((a.profile.displayName) ? a.profile.displayName : a.profile.name).toUpperCase() - const nameB = ((b.profile.displayName) ? b.profile.displayName : b.profile.name).toUpperCase() + const isFiltered = (profile) => (profile.displayName ? profile.displayName : profile.name).toLowerCase().includes(this.filter) + const isNotRequired = (profile) => !this.appManager.isRequired(profile.name) + const isNotHome = (profile) => profile.name !== 'home' + const sortByName = (profileA, profileB) => { + const nameA = ((profileA.displayName) ? profileA.displayName : profileA.name).toUpperCase() + const nameB = ((profileB.displayName) ? profileB.displayName : profileB.name).toUpperCase() return (nameA < nameB) ? -1 : (nameA > nameB) ? 1 : 0 } // Filter all active and inactive modules that are not required - const { actives, inactives } = this.appManager.getAll() + const isActive = (name) => { return this.appManager.actives.includes(name) } + + const {actives, inactives} = this.appManager.getAll() .filter(isFiltered) .filter(isNotRequired) .filter(isNotHome) .sort(sortByName) - .reduce(({actives, inactives}, api) => { - return this.appManager.isActive(api.name) - ? { actives: [...actives, api.name], inactives } - : { inactives: [...inactives, api.name], actives } + .reduce(({actives, inactives}, profile) => { + return isActive(profile.name) ? { actives: [...actives, profile], inactives } + : { inactives: [...inactives, profile], actives } }, { actives: [], inactives: [] }) const activeTile = actives.length !== 0 @@ -203,11 +201,11 @@ class PluginManagerComponent extends ViewPlugin {
${activeTile}
- ${actives.map(name => this.renderItem(name))} + ${actives.map(profile => this.renderItem(profile, isActive(profile.name)))}
${inactiveTile}
- ${inactives.map(name => this.renderItem(name))} + ${inactives.map(profile => this.renderItem(profile, isActive(profile.name)))}
${settings} diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 7f42a62a8b..8aaa9977e5 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -225,9 +225,9 @@ module.exports = class TestTab extends ViewPlugin { return this.generateFileActionElement } - async updateRunAction (currentFile) { + updateRunAction (currentFile) { let el = yo`` - const isSolidityActive = await this.appManager.isActive('solidity') + const isSolidityActive = this.appManager.actives.includes('solidity') if (!currentFile || !isSolidityActive) { el.setAttribute('disabled', 'disabled') if (!currentFile) el.setAttribute('title', 'No file selected')