|
|
@ -3,6 +3,7 @@ import React from 'react' // eslint-disable-line |
|
|
|
import ReactDOM from 'react-dom' |
|
|
|
import ReactDOM from 'react-dom' |
|
|
|
import {RemixUiPluginManager} from '@remix-ui/plugin-manager' // eslint-disable-line
|
|
|
|
import {RemixUiPluginManager} from '@remix-ui/plugin-manager' // eslint-disable-line
|
|
|
|
import * as packageJson from '../../../../../package.json' |
|
|
|
import * as packageJson from '../../../../../package.json' |
|
|
|
|
|
|
|
import { ViewPluginUI } from '../plugins/ViewPluginUI' |
|
|
|
const _paq = window._paq = window._paq || [] |
|
|
|
const _paq = window._paq = window._paq || [] |
|
|
|
|
|
|
|
|
|
|
|
const profile = { |
|
|
|
const profile = { |
|
|
@ -31,6 +32,7 @@ class PluginManagerComponent extends ViewPlugin { |
|
|
|
this.inactivePlugins = [] |
|
|
|
this.inactivePlugins = [] |
|
|
|
this.activeProfiles = this.appManager.actives |
|
|
|
this.activeProfiles = this.appManager.actives |
|
|
|
this._paq = _paq |
|
|
|
this._paq = _paq |
|
|
|
|
|
|
|
this.dispatch = null |
|
|
|
this.listenOnEvent() |
|
|
|
this.listenOnEvent() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -40,7 +42,7 @@ class PluginManagerComponent extends ViewPlugin { |
|
|
|
* RemixAppManager |
|
|
|
* RemixAppManager |
|
|
|
* @param {string} name name of Plugin |
|
|
|
* @param {string} name name of Plugin |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
isActive (name) { |
|
|
|
isActive = (name) =>{ |
|
|
|
return this.appManager.actives.includes(name) |
|
|
|
return this.appManager.actives.includes(name) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -49,7 +51,7 @@ class PluginManagerComponent extends ViewPlugin { |
|
|
|
* RemixAppManager to enable plugin activation |
|
|
|
* RemixAppManager to enable plugin activation |
|
|
|
* @param {string} name name of Plugin |
|
|
|
* @param {string} name name of Plugin |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
activateP (name) { |
|
|
|
activateP = (name) => { |
|
|
|
this.appManager.activatePlugin(name) |
|
|
|
this.appManager.activatePlugin(name) |
|
|
|
_paq.push(['trackEvent', 'manager', 'activate', name]) |
|
|
|
_paq.push(['trackEvent', 'manager', 'activate', name]) |
|
|
|
} |
|
|
|
} |
|
|
@ -60,7 +62,7 @@ class PluginManagerComponent extends ViewPlugin { |
|
|
|
* @param {Profile} pluginName |
|
|
|
* @param {Profile} pluginName |
|
|
|
* @returns {void} |
|
|
|
* @returns {void} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async activateAndRegisterLocalPlugin (localPlugin) { |
|
|
|
activateAndRegisterLocalPlugin = async (localPlugin) => { |
|
|
|
if (localPlugin) { |
|
|
|
if (localPlugin) { |
|
|
|
this.engine.register(localPlugin) |
|
|
|
this.engine.register(localPlugin) |
|
|
|
this.appManager.activatePlugin(localPlugin.profile.name) |
|
|
|
this.appManager.activatePlugin(localPlugin.profile.name) |
|
|
@ -75,28 +77,37 @@ class PluginManagerComponent extends ViewPlugin { |
|
|
|
* of the plugin |
|
|
|
* of the plugin |
|
|
|
* @param {string} name name of Plugin |
|
|
|
* @param {string} name name of Plugin |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
deactivateP (name) { |
|
|
|
deactivateP = (name) => { |
|
|
|
this.call('manager', 'deactivatePlugin', name) |
|
|
|
this.call('manager', 'deactivatePlugin', name) |
|
|
|
_paq.push(['trackEvent', 'manager', 'deactivate', name]) |
|
|
|
_paq.push(['trackEvent', 'manager', 'deactivate', name]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onActivation () { |
|
|
|
onActivation () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setDispatch (dispatch) { |
|
|
|
|
|
|
|
this.dispatch = dispatch |
|
|
|
this.renderComponent() |
|
|
|
this.renderComponent() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateComponent(state){ |
|
|
|
|
|
|
|
return <div id='pluginManager'><RemixUiPluginManager |
|
|
|
|
|
|
|
pluginComponent={state}/></div> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderComponent () { |
|
|
|
renderComponent () { |
|
|
|
ReactDOM.render( |
|
|
|
if(this.dispatch) this.dispatch({...this, activePlugins: this.activePlugins, inactivePlugins: this.inactivePlugins}) |
|
|
|
<RemixUiPluginManager |
|
|
|
|
|
|
|
pluginComponent={this} |
|
|
|
|
|
|
|
/>, |
|
|
|
|
|
|
|
this.htmlElement) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
render () { |
|
|
|
return this.htmlElement |
|
|
|
return ( |
|
|
|
|
|
|
|
<ViewPluginUI plugin={this} /> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getAndFilterPlugins (filter) { |
|
|
|
getAndFilterPlugins = (filter) => { |
|
|
|
this.filter = typeof filter === 'string' ? filter.toLowerCase() : this.filter |
|
|
|
this.filter = typeof filter === 'string' ? filter.toLowerCase() : this.filter |
|
|
|
|
|
|
|
|
|
|
|
const isFiltered = (profile) => (profile.displayName ? profile.displayName : profile.name).toLowerCase().includes(this.filter) |
|
|
|
const isFiltered = (profile) => (profile.displayName ? profile.displayName : profile.name).toLowerCase().includes(this.filter) |
|
|
|