mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-08 13:30:02 +00:00
fixed #6428
This commit is contained in:
parent
fdf9004323
commit
5a2f14746f
@ -79,7 +79,11 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
|||||||
}
|
}
|
||||||
profile.isBuiltin = false
|
profile.isBuiltin = false
|
||||||
profile.isTemplate = false
|
profile.isTemplate = false
|
||||||
await this.showProfileEditModal(profile)
|
const result = await this.showProfileEditModal(profile)
|
||||||
|
if (!result) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Object.assign(profile, result)
|
||||||
if (!profile.name) {
|
if (!profile.name) {
|
||||||
const cfgProxy = this.profilesService.getConfigProxyForProfile(profile)
|
const cfgProxy = this.profilesService.getConfigProxyForProfile(profile)
|
||||||
profile.name = this.profilesService.providerForProfile(profile)?.getSuggestedName(cfgProxy) ?? this.translate.instant('{name} copy', base)
|
profile.name = this.profilesService.providerForProfile(profile)?.getSuggestedName(cfgProxy) ?? this.translate.instant('{name} copy', base)
|
||||||
@ -90,11 +94,15 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async editProfile (profile: PartialProfile<Profile>): Promise<void> {
|
async editProfile (profile: PartialProfile<Profile>): Promise<void> {
|
||||||
await this.showProfileEditModal(profile)
|
const result = await this.showProfileEditModal(profile)
|
||||||
|
if (!result) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Object.assign(profile, result)
|
||||||
await this.config.save()
|
await this.config.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
async showProfileEditModal (profile: PartialProfile<Profile>): Promise<void> {
|
async showProfileEditModal (profile: PartialProfile<Profile>): Promise<PartialProfile<Profile>|null> {
|
||||||
const modal = this.ngbModal.open(
|
const modal = this.ngbModal.open(
|
||||||
EditProfileModalComponent,
|
EditProfileModalComponent,
|
||||||
{ size: 'lg' },
|
{ size: 'lg' },
|
||||||
@ -108,7 +116,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
|||||||
|
|
||||||
const result = await modal.result.catch(() => null)
|
const result = await modal.result.catch(() => null)
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fully replace the config
|
// Fully replace the config
|
||||||
@ -116,9 +124,9 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||||
delete profile[k]
|
delete profile[k]
|
||||||
}
|
}
|
||||||
Object.assign(profile, result)
|
|
||||||
|
|
||||||
profile.type = provider.id
|
result.type = provider.id
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteProfile (profile: PartialProfile<Profile>): Promise<void> {
|
async deleteProfile (profile: PartialProfile<Profile>): Promise<void> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user