mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-22 18:11:43 +03:00
fixes in profile editor
This commit is contained in:
parent
0bd0c850da
commit
d7b305bf29
@ -1,5 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { ConfigService, ElectronService, HostAppService, Platform } from 'terminus-core'
|
||||
import { EditProfileModalComponent } from './editProfileModal.component'
|
||||
import { IShell, Profile } from '../api'
|
||||
@ -12,6 +13,7 @@ export class ShellSettingsTabComponent {
|
||||
shells: IShell[] = []
|
||||
profiles: Profile[] = []
|
||||
Platform = Platform
|
||||
private configSubscription: Subscription
|
||||
|
||||
constructor (
|
||||
public config: ConfigService,
|
||||
@ -21,13 +23,24 @@ export class ShellSettingsTabComponent {
|
||||
private ngbModal: NgbModal,
|
||||
) {
|
||||
config.store.terminal.environment = config.store.terminal.environment || {}
|
||||
this.profiles = config.store.terminal.profiles
|
||||
this.configSubscription = this.config.changed$.subscribe(() => {
|
||||
this.reload()
|
||||
})
|
||||
this.reload()
|
||||
}
|
||||
|
||||
async ngOnInit () {
|
||||
this.shells = await this.terminalService.shells$.toPromise()
|
||||
}
|
||||
|
||||
ngOnDestroy () {
|
||||
this.configSubscription.unsubscribe()
|
||||
}
|
||||
|
||||
reload () {
|
||||
this.profiles = this.config.store.terminal.profiles
|
||||
}
|
||||
|
||||
pickWorkingDirectory () {
|
||||
let shell = this.shells.find(x => x.id === this.config.store.terminal.shell)
|
||||
console.log(shell)
|
||||
@ -45,7 +58,8 @@ export class ShellSettingsTabComponent {
|
||||
name: shell.name,
|
||||
sessionOptions: this.terminalService.optionsFromShell(shell),
|
||||
}
|
||||
this.config.store.terminal.profiles.push(profile)
|
||||
this.profiles.push(profile)
|
||||
this.config.store.terminal.profiles = this.profiles
|
||||
this.config.save()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user