another possible fix for profile editing - #4330

This commit is contained in:
Eugene Pankov 2021-08-05 10:44:00 +02:00
parent 3f0db97a68
commit 533837f5b7
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -72,7 +72,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
}
profile.isBuiltin = false
profile.isTemplate = false
await this.editProfile(profile)
await this.showProfileEditModal(profile)
if (!profile.name) {
const cfgProxy = this.profilesService.getConfigProxyForProfile(profile)
profile.name = this.profilesService.providerForProfile(profile)?.getSuggestedName(cfgProxy) ?? `${base.name} copy`
@ -83,6 +83,11 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
}
async editProfile (profile: PartialProfile<Profile>): Promise<void> {
await this.showProfileEditModal(profile)
await this.config.save()
}
async showProfileEditModal (profile: PartialProfile<Profile>): Promise<void> {
const modal = this.ngbModal.open(
EditProfileModalComponent,
{ size: 'lg' },
@ -97,8 +102,6 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
delete profile[k]
}
Object.assign(profile, result)
await this.config.save()
}
async deleteProfile (profile: PartialProfile<Profile>): Promise<void> {