diff --git a/apps/remix-ide/src/app/components/plugin-manager-component.js b/apps/remix-ide/src/app/components/plugin-manager-component.js index ebd1c9a7e4..ca95b9b400 100644 --- a/apps/remix-ide/src/app/components/plugin-manager-component.js +++ b/apps/remix-ide/src/app/components/plugin-manager-component.js @@ -92,9 +92,10 @@ const profile = { class PluginManagerComponent extends ViewPlugin { constructor (appManager, engine) { super(profile) - // this.event = new EventEmitter() // already exists in engine so not needed here + this.event = new EventEmitter() // already exists in engine so not needed here this.appManager = appManager this.engine = engine + this.pluginManagerSettings = new PluginManagerSettings() this.htmlElement = document.createElement('div') this.htmlElement.setAttribute('id', 'pluginManager') this.views = { @@ -103,9 +104,8 @@ class PluginManagerComponent extends ViewPlugin { } this.localPlugin = new LocalPlugin() this.filter = '' - this.activePlugins = [] - this.inactivePlugins = [] this.pluginNames = this.appManager.actives + // this.pluginManagerSettings. // this.appManager.event.on('activate', () => { this.renderComponent() }) // this.appManager.event.on('deactivate', () => { this.renderComponent() }) // this.engine.event.on('onRegistration', () => { this.renderComponent() }) @@ -116,10 +116,12 @@ class PluginManagerComponent extends ViewPlugin { } activateP (name) { - this.appManager.turnPluginOn(name) - console.log('activateP method reached. And activation of method was successful') + this.appManager.activatePlugin(name) + this.appManager.event.on('activate', () => { + this.renderComponent() + console.log('activateP method reached. And activation of method was successful') + }) _paq.push(['trackEvent', 'manager', 'activate', name]) - this.renderComponent() console.log('activation was logged in _paq and renderComponent has been called.') } @@ -144,10 +146,6 @@ class PluginManagerComponent extends ViewPlugin { engine={this.engine} localPlugin={this.localPlugin} activePluginNames={this.pluginNames} - actives={this.activePlugins} - inactives={this.inactivePlugins} - // activatePlugin={this.activateP} - // deActivatePlugin={this.deactivateP} _paq={_paq} filter={this.filter} />, diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index fb1ef54a80..45bc5a7421 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -75,14 +75,6 @@ export class RemixAppManager extends PluginManager { return await this.permissionHandler.askPermission(this.profiles[from], this.profiles[to], method, message) } - async turnPluginOn (name) { - await this.activatePlugin(name) - } - - async turnPluginOff (name) { - await this.deactivatePlugin(name) - } - onPluginActivated (plugin) { this.pluginLoader.set(plugin, this.actives) this.event.emit('activate', plugin) diff --git a/libs/remix-ui/plugin-manager/src/lib/components/button.tsx b/libs/remix-ui/plugin-manager/src/lib/components/button.tsx index 203e0b5741..54cb447fa1 100644 --- a/libs/remix-ui/plugin-manager/src/lib/components/button.tsx +++ b/libs/remix-ui/plugin-manager/src/lib/components/button.tsx @@ -1,13 +1,17 @@ -import React, { useContext, useState } from 'react' -import { PluginManagerContext } from '../contexts/pluginmanagercontext' +import React, { useState } from 'react' +import { PluginManagerComponent } from '../../types' interface ButtonProps { buttonText: 'Activate' | 'Deactivate' pluginName: string + pluginComponent: PluginManagerComponent } -function Button ({ buttonText, pluginName }: ButtonProps) { - const { pluginComponent } = useContext(PluginManagerContext) +function Button ({ + buttonText, + pluginName, + pluginComponent +}: ButtonProps) { const dataId = `pluginManagerComponentDeactivateButton${pluginName}` const [needToDeactivate] = useState('btn btn-secondary btn-sm') const [needToActivate] = useState('btn btn-success btn-sm') diff --git a/libs/remix-ui/plugin-manager/src/lib/components/permissions/permissionsSettings.tsx b/libs/remix-ui/plugin-manager/src/lib/components/permissions/permissionsSettings.tsx new file mode 100644 index 0000000000..ce24c1729a --- /dev/null +++ b/libs/remix-ui/plugin-manager/src/lib/components/permissions/permissionsSettings.tsx @@ -0,0 +1,97 @@ +import React, { Fragment, useState } from 'react' +import { RemixUiCheckbox } from '@remix-ui/checkbox' +import { PluginManagerSettings } from '../../../types' +import { ModalDialog } from '@remix-ui/modal-dialog' + +interface PermissionSettingsProps { + pluginSettings: PluginManagerSettings + toPlugin?: string + funcObj?: {} + methodName?: string + fromPlugins?: {} + +} + +//