Merge pull request #9082 from Ranhiru/fix-not-showing-custom-profiles-in-settings

This commit is contained in:
Eugene 2023-10-09 13:07:28 +02:00 committed by GitHub
commit e68bd6c746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -12,14 +12,16 @@ ul.nav-tabs(ngbNav, #nav='ngbNav')
[(ngModel)]='config.store.terminal.profile', [(ngModel)]='config.store.terminal.profile',
(ngModelChange)='config.save()', (ngModelChange)='config.save()',
) )
option( optgroup([label]='"Custom Profiles"|translate', *ngIf='customProfiles?.length > 0')
*ngFor='let profile of profiles', option(
[ngValue]='profile.id' *ngFor='let profile of customProfiles',
) {{profile.name}} [ngValue]='profile.id'
option( ) {{profile.name}}
*ngFor='let profile of builtinProfiles', optgroup([label]='"Built-in Profiles"|translate')
[ngValue]='profile.id' option(
) {{profile.name}} *ngFor='let profile of builtinProfiles',
[ngValue]='profile.id'
) {{profile.name}}
.d-flex.mb-3 .d-flex.mb-3
.input-group .input-group

View File

@ -21,6 +21,7 @@ interface CollapsableProfileGroup extends ProfileGroup {
export class ProfilesSettingsTabComponent extends BaseComponent { export class ProfilesSettingsTabComponent extends BaseComponent {
builtinProfiles: PartialProfile<Profile>[] = [] builtinProfiles: PartialProfile<Profile>[] = []
templateProfiles: PartialProfile<Profile>[] = [] templateProfiles: PartialProfile<Profile>[] = []
customProfiles: PartialProfile<Profile>[] = []
profileGroups: PartialProfileGroup<CollapsableProfileGroup>[] profileGroups: PartialProfileGroup<CollapsableProfileGroup>[]
filter = '' filter = ''
Platform = Platform Platform = Platform
@ -42,6 +43,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
async ngOnInit (): Promise<void> { async ngOnInit (): Promise<void> {
this.refresh() this.refresh()
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.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.refresh()