|
|
@ -31,8 +31,8 @@ class PluginManagerComponent { |
|
|
|
|
|
|
|
|
|
|
|
setStore (store) { |
|
|
|
setStore (store) { |
|
|
|
this.store = store |
|
|
|
this.store = store |
|
|
|
this.store.event.on('activate', (name) => { this.views.items[name] ? this.views.items[name].querySelector('button').innerHTML = 'deactivate' : null }) |
|
|
|
this.store.event.on('activate', (name) => { this.reRender() }) |
|
|
|
this.store.event.on('deactivate', (name) => { this.views.items[name] ? this.views.items[name].querySelector('button').innerHTML = 'activate' : null }) |
|
|
|
this.store.event.on('deactivate', (name) => { this.reRender() }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
render () { |
|
|
@ -46,7 +46,7 @@ class PluginManagerComponent { |
|
|
|
<h3>Inactive Modules</h3> |
|
|
|
<h3>Inactive Modules</h3> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
` |
|
|
|
` |
|
|
|
this.views.root = yo` |
|
|
|
var rootView = yo` |
|
|
|
<div id='pluginManager' class=${css.plugins_settings} > |
|
|
|
<div id='pluginManager' class=${css.plugins_settings} > |
|
|
|
<h2>Plugin Manager</h2> |
|
|
|
<h2>Plugin Manager</h2> |
|
|
|
<input placeholder="Search loaded plugins"> |
|
|
|
<input placeholder="Search loaded plugins"> |
|
|
@ -69,12 +69,14 @@ class PluginManagerComponent { |
|
|
|
var modulesAll = this.store.getAll() |
|
|
|
var modulesAll = this.store.getAll() |
|
|
|
modulesAll.sort() |
|
|
|
modulesAll.sort() |
|
|
|
modulesAll.forEach((mod) => { |
|
|
|
modulesAll.forEach((mod) => { |
|
|
|
if ( !(modulesActive.includes(mod)) ) { |
|
|
|
if (!modulesActive.includes(mod)) { |
|
|
|
this.views.inactiveMods.appendChild(this.renderItem(mod.profile.name)) |
|
|
|
this.views.inactiveMods.appendChild(this.renderItem(mod.profile.name)) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
if (!this.views.root) { |
|
|
|
return this.views.root |
|
|
|
this.views.root = rootView |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return rootView |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderItem (item) { |
|
|
|
renderItem (item) { |
|
|
@ -82,13 +84,11 @@ class PluginManagerComponent { |
|
|
|
|
|
|
|
|
|
|
|
const mod = this.store.getOne(item) |
|
|
|
const mod = this.store.getOne(item) |
|
|
|
if (!mod) return |
|
|
|
if (!mod) return |
|
|
|
let action = async() => {
|
|
|
|
let action = () => {
|
|
|
|
if (this.store.isActive(item)) { |
|
|
|
if (this.store.isActive(item)) { |
|
|
|
await this.appManager.deactivateOne(item) |
|
|
|
this.appManager.deactivateOne(item) |
|
|
|
this.reRender() |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
await this.appManager.activateOne(item) |
|
|
|
this.appManager.activateOne(item) |
|
|
|
this.reRender() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -103,14 +103,13 @@ class PluginManagerComponent { |
|
|
|
${ctrBtns} |
|
|
|
${ctrBtns} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
` |
|
|
|
` |
|
|
|
|
|
|
|
|
|
|
|
return this.views.items[item] |
|
|
|
return this.views.items[item] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
reRender (item) { |
|
|
|
reRender () { |
|
|
|
document.getElementById('pluginManager').innerHTML = '' |
|
|
|
if (this.views.root) { |
|
|
|
let piMan = this.render() |
|
|
|
yo.update(this.views.root, this.render()) |
|
|
|
document.getElementById('pluginManager').appendChild(piMan) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|