cleanup saving

This commit is contained in:
Eugene 2023-08-25 23:03:02 +02:00
parent 0128013308
commit 96eee51590
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -88,7 +88,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
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)
} }
this.profilesService.newProfile(profile).then(() => this.config.save()) await this.profilesService.newProfile(profile)
await this.config.save()
} }
async editProfile (profile: PartialProfile<Profile>): Promise<void> { async editProfile (profile: PartialProfile<Profile>): Promise<void> {
@ -97,7 +98,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
return return
} }
Object.assign(profile, result) Object.assign(profile, result)
await this.profilesService.writeProfile(profile).then(() => this.config.save()) await this.profilesService.writeProfile(profile)
await this.config.save()
} }
async showProfileEditModal (profile: PartialProfile<Profile>): Promise<PartialProfile<Profile>|null> { async showProfileEditModal (profile: PartialProfile<Profile>): Promise<PartialProfile<Profile>|null> {
@ -140,7 +142,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
cancelId: 1, cancelId: 1,
}, },
)).response === 0) { )).response === 0) {
this.profilesService.deleteProfile(profile).then(() => this.config.save()) await this.profilesService.deleteProfile(profile)
await this.config.save()
} }
} }
@ -149,7 +152,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
modal.componentInstance.prompt = this.translate.instant('New group name') modal.componentInstance.prompt = this.translate.instant('New group name')
const result = await modal.result.catch(() => null) const result = await modal.result.catch(() => null)
if (result?.value.trim()) { if (result?.value.trim()) {
await this.profilesService.newProfileGroup({ id: '', name: result.value }).then(() => this.config.save()) await this.profilesService.newProfileGroup({ id: '', name: result.value })
await this.config.save()
} }
} }
@ -159,7 +163,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
return return
} }
Object.assign(group, result) Object.assign(group, result)
await this.profilesService.writeProfileGroup(ProfilesSettingsTabComponent.collapsableIntoPartialProfileGroup(group)).then(() => this.config.save()) await this.profilesService.writeProfileGroup(ProfilesSettingsTabComponent.collapsableIntoPartialProfileGroup(group))
await this.config.save()
} }
async showProfileGroupEditModal (group: PartialProfileGroup<CollapsableProfileGroup>): Promise<PartialProfileGroup<CollapsableProfileGroup>|null> { async showProfileGroupEditModal (group: PartialProfileGroup<CollapsableProfileGroup>): Promise<PartialProfileGroup<CollapsableProfileGroup>|null> {
@ -239,7 +244,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
deleteProfiles = true deleteProfiles = true
} }
await this.profilesService.deleteProfileGroup(group, { deleteProfiles }).then(() => this.config.save()) await this.profilesService.deleteProfileGroup(group, { deleteProfiles })
await this.config.save()
} }
} }