Skip to content

Commit

Permalink
- Fixed change of addons when changing ovh vps tariff
Browse files Browse the repository at this point in the history
  • Loading branch information
639852 committed Sep 3, 2024
1 parent a4972eb commit ed41e25
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/cloud/modules/ovh vps/openInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,21 @@ export default defineComponent({
try {
this.isSwitchLoading = true
const { price, resources } = this.tariffs[this.planCode]
const { price, resources, meta } = this.tariffs[this.planCode] ?? {}
const backupIndex = instance.config.addons.findIndex((key) => key.includes('backup'))
const snapshotIndex = instance.config.addons.findIndex((key) => key.includes('snapshot'))
if (backupIndex !== -1) {
const backup = meta.addons.find((key) => key.includes('backup'))
instance.config.addons.splice(backupIndex, 1, backup)
}
if (snapshotIndex !== -1) {
const snapshot = meta.addons.find((key) => key.includes('snapshot'))
instance.config.addons.splice(snapshotIndex, 1, snapshot)
}
instance.config.planCode = this.planCode.split(' ')[1]
instance.product = this.planCode
Expand Down

0 comments on commit ed41e25

Please sign in to comment.