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