mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
wip ref(core): Profile avoid direct config interraction outside of profiles.services
This commit is contained in:
@@ -4,7 +4,7 @@ import slugify from 'slugify'
|
||||
import deepClone from 'clone-deep'
|
||||
import { Component, Inject } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { ConfigService, HostAppService, Profile, SelectorService, ProfilesService, PromptModalComponent, PlatformService, BaseComponent, PartialProfile, ProfileProvider, TranslateService, Platform, AppHotkeyProvider, ProfileGroup, PartialProfileGroup } from 'tabby-core'
|
||||
import { ConfigService, HostAppService, Profile, SelectorService, ProfilesService, PromptModalComponent, PlatformService, BaseComponent, PartialProfile, ProfileProvider, TranslateService, Platform, ProfileGroup, PartialProfileGroup } from 'tabby-core'
|
||||
import { EditProfileModalComponent } from './editProfileModal.component'
|
||||
|
||||
_('Filter')
|
||||
@@ -94,7 +94,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
||||
return
|
||||
}
|
||||
Object.assign(profile, result)
|
||||
await this.config.save()
|
||||
await this.profilesService.writeProfile(profile)
|
||||
}
|
||||
|
||||
async showProfileEditModal (profile: PartialProfile<Profile>): Promise<PartialProfile<Profile>|null> {
|
||||
@@ -137,17 +137,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
||||
cancelId: 1,
|
||||
},
|
||||
)).response === 0) {
|
||||
this.profilesService.providerForProfile(profile)?.deleteProfile(
|
||||
this.profilesService.getConfigProxyForProfile(profile))
|
||||
this.config.store.profiles = this.config.store.profiles.filter(x => x !== profile)
|
||||
const profileHotkeyName = AppHotkeyProvider.getProfileHotkeyName(profile)
|
||||
if (this.config.store.hotkeys.profile.hasOwnProperty(profileHotkeyName)) {
|
||||
const profileHotkeys = deepClone(this.config.store.hotkeys.profile)
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete profileHotkeys[profileHotkeyName]
|
||||
this.config.store.hotkeys.profile = profileHotkeys
|
||||
}
|
||||
await this.config.save()
|
||||
this.profilesService.deleteProfile(profile)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user