fixed #7727 - allow hiding individual profiles from the selector

This commit is contained in:
Eugene Pankov 2023-06-04 21:22:05 +02:00
parent e813133f12
commit c983743b57
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
4 changed files with 54 additions and 7 deletions

View File

@ -48,6 +48,7 @@ enableExperimentalFeatures: false
pluginBlacklist: []
commandBlacklist: []
providerBlacklist: []
profileBlacklist: []
hacks:
disableGPU: false
disableVibrancyWhileDragging: false

View File

@ -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,

View File

@ -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
.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.btn.btn-link.hover-reveal.ms-1(
*ngIf='!profile.isBuiltin',
(click)='$event.stopPropagation(); deleteProfile(profile)'
)
i.fas.fa-trash-alt
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)

View File

@ -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)
}
}