diff --git a/tabby-core/src/services/profiles.service.ts b/tabby-core/src/services/profiles.service.ts index 7427039e..229ff941 100644 --- a/tabby-core/src/services/profiles.service.ts +++ b/tabby-core/src/services/profiles.service.ts @@ -410,11 +410,13 @@ export class ProfilesService { }) if (includeNonUserGroup) { - const builtIn: PartialProfileGroup = { + const builtInGroups: PartialProfileGroup[] = [] + builtInGroups.push({ id: 'built-in', name: this.translate.instant('Built-in'), editable: false, - } + profiles: [], + }) const ungrouped: PartialProfileGroup = { id: 'ungrouped', @@ -423,13 +425,25 @@ export class ProfilesService { } if (includeProfiles) { - builtIn.profiles = profiles.filter(p => p.isBuiltin) - profiles = profiles.filter(p => !p.isBuiltin) + for (const profile of profiles.filter(p => p.isBuiltin)) { + let group: PartialProfileGroup | undefined = builtInGroups.find(g => g.id === slugify(profile.group ?? 'built-in')) + if (!group) { + group = { + id: `${slugify(profile.group!)}`, + name: `${profile.group!}`, + editable: false, + profiles: [], + } + builtInGroups.push(group) + } - ungrouped.profiles = profiles + group.profiles!.push(profile) + } + + ungrouped.profiles = profiles.filter(p => !p.isBuiltin) } - groups.push(builtIn) + groups = groups.concat(builtInGroups) groups.push(ungrouped) } diff --git a/tabby-settings/src/components/profilesSettingsTab.component.ts b/tabby-settings/src/components/profilesSettingsTab.component.ts index cc6bf7f9..08e78561 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.ts +++ b/tabby-settings/src/components/profilesSettingsTab.component.ts @@ -144,7 +144,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent { const profileGroupCollapsed = JSON.parse(window.localStorage.profileGroupCollapsed ?? '{}') const groups = await this.profilesService.getProfileGroups(true, true) groups.sort((a, b) => a.name.localeCompare(b.name)) - groups.sort((a, b) => (a.id === 'built-in' ? 1 : 0) - (b.id === 'built-in' ? 1 : 0)) + groups.sort((a, b) => (a.id === 'built-in' || !a.editable ? 1 : 0) - (b.id === 'built-in' || !b.editable ? 1 : 0)) groups.sort((a, b) => (a.id === 'ungrouped' ? 0 : 1) - (b.id === 'ungrouped' ? 0 : 1)) this.profileGroups = groups.map(g => ProfilesSettingsTabComponent.intoPartialCollapsableProfileGroup(g, profileGroupCollapsed[g.id] ?? false)) }