From c983743b57d90246d997b1ebf328a5c6696ac315 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 4 Jun 2023 21:22:05 +0200 Subject: [PATCH] fixed #7727 - allow hiding individual profiles from the selector --- tabby-core/src/configDefaults.yaml | 1 + tabby-core/src/services/profiles.service.ts | 2 + .../profilesSettingsTab.component.pug | 46 +++++++++++++++---- .../profilesSettingsTab.component.ts | 14 ++++++ 4 files changed, 55 insertions(+), 8 deletions(-) diff --git a/tabby-core/src/configDefaults.yaml b/tabby-core/src/configDefaults.yaml index 6f63b8d189..d862439166 100644 --- a/tabby-core/src/configDefaults.yaml +++ b/tabby-core/src/configDefaults.yaml @@ -48,6 +48,7 @@ enableExperimentalFeatures: false pluginBlacklist: [] commandBlacklist: [] providerBlacklist: [] +profileBlacklist: [] hacks: disableGPU: false disableVibrancyWhileDragging: false diff --git a/tabby-core/src/services/profiles.service.ts b/tabby-core/src/services/profiles.service.ts index 25655d22e9..295909e781 100644 --- a/tabby-core/src/services/profiles.service.ts +++ b/tabby-core/src/services/profiles.service.ts @@ -153,6 +153,8 @@ export class ProfilesService { profiles = profiles.filter(x => !x.isTemplate) + profiles = profiles.filter(x => x.id && !this.config.store.profileBlacklist.includes(x.id)) + options = [...options, ...profiles.map((p): SelectorOption => ({ ...this.selectorOptionForProfile(p), weight: p.isBuiltin ? 2 : 1, diff --git a/tabby-settings/src/components/profilesSettingsTab.component.pug b/tabby-settings/src/components/profilesSettingsTab.component.pug index b2b11455e0..0513f26b95 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.pug +++ b/tabby-settings/src/components/profilesSettingsTab.component.pug @@ -70,17 +70,47 @@ ul.nav-tabs(ngbNav, #nav='ngbNav') button.btn.btn-link.hover-reveal.ms-1((click)='$event.stopPropagation(); launchProfile(profile)') i.fas.fa-play - button.btn.btn-link.hover-reveal.ms-1((click)='$event.stopPropagation(); newProfile(profile)') - i.fas.fa-copy - - button.btn.btn-link.hover-reveal.ms-1( - *ngIf='!profile.isBuiltin', - (click)='$event.stopPropagation(); deleteProfile(profile)' - ) - i.fas.fa-trash-alt + .ms-1.hover-reveal(ngbDropdown, placement='bottom-right top-right auto') + button.btn.btn-link.ms-1( + ngbDropdownToggle, + (click)='$event.stopPropagation()' + ) + i.fas.fa-fw.fa-ellipsis-vertical + div(ngbDropdownMenu) + button.dropdown-item( + ngbDropdownItem, + (click)='$event.stopPropagation(); newProfile(profile)' + ) + i.fas.fa-fw.fa-copy + span(translate) Duplicate + + button.dropdown-item( + ngbDropdownItem, + *ngIf='profile.id && !isProfileBlacklisted(profile)', + (click)='$event.stopPropagation(); blacklistProfile(profile)' + ) + i.fas.fa-fw.fa-eye-slash + span(translate) Hide + + button.dropdown-item( + ngbDropdownItem, + *ngIf='profile.id && isProfileBlacklisted(profile)', + (click)='$event.stopPropagation(); unblacklistProfile(profile)' + ) + i.fas.fa-fw.fa-eye + span(translate) Show + + button.dropdown-item( + *ngIf='!profile.isBuiltin', + (click)='$event.stopPropagation(); deleteProfile(profile)' + ) + i.fas.fa-fw.fa-trash-alt + span(translate) Delete .ms-1(class='badge text-bg-{{getTypeColorClass(profile)}}') {{getTypeLabel(profile)}} + .ms-1.text-danger.fas.fa-eye-slash(*ngIf='isProfileBlacklisted(profile)') + li(ngbNavItem) a(ngbNavLink, translate) Advanced ng-template(ngbNavContent) diff --git a/tabby-settings/src/components/profilesSettingsTab.component.ts b/tabby-settings/src/components/profilesSettingsTab.component.ts index 4c1c0434ec..5b35b11f90 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.ts +++ b/tabby-settings/src/components/profilesSettingsTab.component.ts @@ -297,4 +297,18 @@ export class ProfilesSettingsTabComponent extends BaseComponent { this.config.store.profileDefaults[provider.id] = model await this.config.save() } + + blacklistProfile (profile: PartialProfile): void { + this.config.store.profileBlacklist = [...this.config.store.profileBlacklist, profile.id] + this.config.save() + } + + unblacklistProfile (profile: PartialProfile): void { + this.config.store.profileBlacklist = this.config.store.profileBlacklist.filter(x => x !== profile.id) + this.config.save() + } + + isProfileBlacklisted (profile: PartialProfile): boolean { + return profile.id && this.config.store.profileBlacklist.includes(profile.id) + } }