Skip to content

Commit

Permalink
fixed #7727 - allow hiding individual profiles from the selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Jun 4, 2023
1 parent e813133 commit c983743
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 8 deletions.
1 change: 1 addition & 0 deletions tabby-core/src/configDefaults.yaml
Expand Up @@ -48,6 +48,7 @@ enableExperimentalFeatures: false
pluginBlacklist: []
commandBlacklist: []
providerBlacklist: []
profileBlacklist: []
hacks:
disableGPU: false
disableVibrancyWhileDragging: false
Expand Down
2 changes: 2 additions & 0 deletions tabby-core/src/services/profiles.service.ts
Expand Up @@ -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<void> => ({
...this.selectorOptionForProfile(p),
weight: p.isBuiltin ? 2 : 1,
Expand Down
46 changes: 38 additions & 8 deletions tabby-settings/src/components/profilesSettingsTab.component.pug
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions tabby-settings/src/components/profilesSettingsTab.component.ts
Expand Up @@ -297,4 +297,18 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
this.config.store.profileDefaults[provider.id] = model
await this.config.save()
}

blacklistProfile (profile: PartialProfile<Profile>): void {
this.config.store.profileBlacklist = [...this.config.store.profileBlacklist, profile.id]
this.config.save()
}

unblacklistProfile (profile: PartialProfile<Profile>): void {
this.config.store.profileBlacklist = this.config.store.profileBlacklist.filter(x => x !== profile.id)
this.config.save()
}

isProfileBlacklisted (profile: PartialProfile<Profile>): boolean {
return profile.id && this.config.store.profileBlacklist.includes(profile.id)
}
}

0 comments on commit c983743

Please sign in to comment.