mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-22 19:38:00 +00:00
Refresh default profile selection when profiles are modified
This commit is contained in:
@@ -20,6 +20,7 @@ interface CollapsableProfileGroup extends ProfileGroup {
|
|||||||
})
|
})
|
||||||
export class ProfilesSettingsTabComponent extends BaseComponent {
|
export class ProfilesSettingsTabComponent extends BaseComponent {
|
||||||
builtinProfiles: PartialProfile<Profile>[] = []
|
builtinProfiles: PartialProfile<Profile>[] = []
|
||||||
|
profiles: PartialProfile<Profile>[] = []
|
||||||
templateProfiles: PartialProfile<Profile>[] = []
|
templateProfiles: PartialProfile<Profile>[] = []
|
||||||
customProfiles: PartialProfile<Profile>[] = []
|
customProfiles: PartialProfile<Profile>[] = []
|
||||||
profileGroups: PartialProfileGroup<CollapsableProfileGroup>[]
|
profileGroups: PartialProfileGroup<CollapsableProfileGroup>[]
|
||||||
@@ -41,13 +42,17 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit (): Promise<void> {
|
async ngOnInit (): Promise<void> {
|
||||||
this.refresh()
|
await this.refreshProfileGroups()
|
||||||
|
await this.refreshProfiles()
|
||||||
|
this.subscribeUntilDestroyed(this.config.changed$, () => this.refreshProfileGroups())
|
||||||
|
this.subscribeUntilDestroyed(this.config.changed$, () => this.refreshProfiles())
|
||||||
|
}
|
||||||
|
|
||||||
|
async refreshProfiles (): Promise<void> {
|
||||||
this.builtinProfiles = (await this.profilesService.getProfiles()).filter(x => x.isBuiltin)
|
this.builtinProfiles = (await this.profilesService.getProfiles()).filter(x => x.isBuiltin)
|
||||||
this.customProfiles = (await this.profilesService.getProfiles()).filter(x => !x.isBuiltin)
|
this.customProfiles = (await this.profilesService.getProfiles()).filter(x => !x.isBuiltin)
|
||||||
this.templateProfiles = this.builtinProfiles.filter(x => x.isTemplate)
|
this.templateProfiles = this.builtinProfiles.filter(x => x.isTemplate)
|
||||||
this.builtinProfiles = this.builtinProfiles.filter(x => !x.isTemplate)
|
this.builtinProfiles = this.builtinProfiles.filter(x => !x.isTemplate)
|
||||||
this.refresh()
|
|
||||||
this.subscribeUntilDestroyed(this.config.changed$, () => this.refresh())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
launchProfile (profile: PartialProfile<Profile>): void {
|
launchProfile (profile: PartialProfile<Profile>): void {
|
||||||
@@ -242,7 +247,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async refresh (): Promise<void> {
|
async refreshProfileGroups (): Promise<void> {
|
||||||
const profileGroupCollapsed = JSON.parse(window.localStorage.profileGroupCollapsed ?? '{}')
|
const profileGroupCollapsed = JSON.parse(window.localStorage.profileGroupCollapsed ?? '{}')
|
||||||
const groups = await this.profilesService.getProfileGroups({ includeNonUserGroup: true, includeProfiles: true })
|
const groups = await this.profilesService.getProfileGroups({ includeNonUserGroup: true, includeProfiles: true })
|
||||||
groups.sort((a, b) => a.name.localeCompare(b.name))
|
groups.sort((a, b) => a.name.localeCompare(b.name))
|
||||||
|
Reference in New Issue
Block a user