diff --git a/terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug b/terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug index e595893f..2345a363 100644 --- a/terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug +++ b/terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug @@ -2,7 +2,6 @@ strong Error in {{erroredPlugin}}: pre {{errorMessage}} - .d-flex h3.mb-1 Installed button.btn.btn-outline-secondary.btn-sm.ml-auto((click)='openPluginsFolder()') @@ -11,11 +10,16 @@ .list-group.list-group-flush.mt-2 .list-group-item.d-flex.align-items-center(*ngFor='let plugin of pluginManager.installedPlugins') + toggle( + [ngModel]='isPluginEnabled(plugin)', + (ngModelChange)='togglePlugin(plugin)' + ) + .mr-auto.d-flex.flex-column div strong {{plugin.name}} small.text-muted.ml-1(*ngIf='!plugin.isBuiltin') {{plugin.version}} / {{plugin.author}} - small.text-warning.ml-1(*ngIf='config.store.pluginBlacklist.includes(plugin.name)') Disabled + small.text-warning.ml-1(*ngIf='!isPluginEnabled(plugin)') Disabled a.text-muted.mb-0((click)='showPluginInfo(plugin)') small {{plugin.description}} @@ -28,18 +32,6 @@ i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy.get(plugin.name) == BusyState.Installing') span Upgrade ({{knownUpgrades[plugin.name].version}}) - button.btn.btn-link.text-primary.ml-2( - *ngIf='config.store.pluginBlacklist.includes(plugin.name)', - (click)='enablePlugin(plugin)' - ) - i.fas.fa-fw.fa-play - - button.btn.btn-link.ml-2( - *ngIf='!config.store.pluginBlacklist.includes(plugin.name)', - (click)='disablePlugin(plugin)' - ) - i.fas.fa-fw.fa-pause - button.btn.btn-link.text-danger.ml-2( (click)='uninstallPlugin(plugin)', *ngIf='!plugin.isBuiltin', diff --git a/terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts b/terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts index 0ca124fc..f07fd677 100644 --- a/terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts +++ b/terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts @@ -102,6 +102,18 @@ export class PluginsSettingsTabComponent { this.electron.shell.openExternal('https://www.npmjs.com/package/' + plugin.packageName) } + isPluginEnabled (plugin: PluginInfo) { + return !this.config.store.pluginBlacklist.includes(plugin.name) + } + + togglePlugin (plugin: PluginInfo) { + if (this.isPluginEnabled(plugin)) { + this.disablePlugin(plugin) + } else { + this.enablePlugin(plugin) + } + } + enablePlugin (plugin: PluginInfo) { this.config.store.pluginBlacklist = this.config.store.pluginBlacklist.filter(x => x !== plugin.name) this.config.save() diff --git a/terminus-plugin-manager/src/index.ts b/terminus-plugin-manager/src/index.ts index fb49c226..57638989 100644 --- a/terminus-plugin-manager/src/index.ts +++ b/terminus-plugin-manager/src/index.ts @@ -3,6 +3,7 @@ import { BrowserModule } from '@angular/platform-browser' import { FormsModule } from '@angular/forms' import { NgbModule } from '@ng-bootstrap/ng-bootstrap' +import TerminusCorePlugin from 'terminus-core' import { SettingsTabProvider } from 'terminus-settings' import { PluginsSettingsTabComponent } from './components/pluginsSettingsTab.component' @@ -14,6 +15,7 @@ import { PluginsSettingsTabProvider } from './settings' BrowserModule, FormsModule, NgbModule, + TerminusCorePlugin, ], providers: [ { provide: SettingsTabProvider, useClass: PluginsSettingsTabProvider, multi: true },