allow disabling plugins

This commit is contained in:
Eugene Pankov
2017-11-26 22:14:46 +01:00
parent 0c15f5033d
commit 0de12b6b38
17 changed files with 92 additions and 42 deletions

View File

@@ -27,7 +27,7 @@ export class TerminalSettingsTabComponent {
@Inject(TerminalColorSchemeProvider) private colorSchemeProviders: TerminalColorSchemeProvider[],
@Inject(SessionPersistenceProvider) persistenceProviders: SessionPersistenceProvider[],
) {
this.persistenceProviders = persistenceProviders.filter(x => x.isAvailable())
this.persistenceProviders = this.config.enabledServices(persistenceProviders).filter(x => x.isAvailable())
}
async ngOnInit () {
@@ -46,8 +46,8 @@ export class TerminalSettingsTabComponent {
this.fonts.sort()
})
}
this.colorSchemes = (await Promise.all(this.colorSchemeProviders.map(x => x.getSchemes()))).reduce((a, b) => a.concat(b))
this.shells = (await Promise.all(this.shellProviders.map(x => x.provide()))).reduce((a, b) => a.concat(b))
this.colorSchemes = (await Promise.all(this.config.enabledServices(this.colorSchemeProviders).map(x => x.getSchemes()))).reduce((a, b) => a.concat(b))
this.shells = (await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))).reduce((a, b) => a.concat(b))
}
fontAutocomplete = (text$: Observable<string>) => {

View File

@@ -125,7 +125,7 @@ export class TerminalTabComponent extends BaseTabComponent {
})
this.hterm = new hterm.hterm.Terminal()
this.decorators.forEach((decorator) => {
this.config.enabledServices(this.decorators).forEach((decorator) => {
decorator.attach(this)
})
@@ -406,7 +406,7 @@ export class TerminalTabComponent extends BaseTabComponent {
}
ngOnDestroy () {
this.decorators.forEach(decorator => {
this.config.enabledServices(this.decorators).forEach(decorator => {
decorator.detach(this)
})
this.hotkeysSubscription.unsubscribe()

View File

@@ -202,7 +202,7 @@ export class SessionsService {
) {
nodePTY = electron.remoteRequirePluginModule('terminus-terminal', 'node-pty-tmp', global as any)
this.logger = log.create('sessions')
this.persistenceProviders = this.persistenceProviders.filter(x => x.isAvailable())
this.persistenceProviders = this.config.enabledServices(this.persistenceProviders).filter(x => x.isAvailable())
}
async prepareNewSession (options: SessionOptions): Promise<SessionOptions> {

View File

@@ -27,7 +27,7 @@ export class TerminalService {
async reloadShells () {
this.shells$ = new AsyncSubject<IShell[]>()
let shellLists = await Promise.all(this.shellProviders.map(x => x.provide()))
let shellLists = await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))
this.shells$.next(shellLists.reduce((a, b) => a.concat(b)))
this.shells$.complete()
}