tweaked plugins ui

This commit is contained in:
Eugene Pankov 2021-02-13 13:53:25 +01:00
parent 661d5af9ba
commit 9cb10c3e21
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
3 changed files with 20 additions and 14 deletions

View file

@ -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',

View file

@ -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()

View file

@ -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 },