diff --git a/src/components/cloud/modules/ovh vps/openInstance.vue b/src/components/cloud/modules/ovh vps/openInstance.vue index 2cb35985..f3036744 100644 --- a/src/components/cloud/modules/ovh vps/openInstance.vue +++ b/src/components/cloud/modules/ovh vps/openInstance.vue @@ -220,7 +220,7 @@ {{ $t('ram') }}: {{ tariffs[planCode].resources.ram / 1024 }} Gb {{ $t('disk') }}: - {{ tariffs[planCode].resources.disk / 1024 }} Gb + {{ driveSize }} Gb @@ -322,7 +322,7 @@ {{ $t("cloud_Size") }}
- {{ (VM.resources.drive_size / 1024).toFixed(2) }} GB + {{ ((VM.resources.drive_size ?? VM.resources.disk) / 1024).toFixed(2) }} GB
@@ -760,8 +760,10 @@ export default defineComponent({ return { code: this.userdata.currency ?? this.defaultCurrency } }, renewalProps () { - const key = `${this.VM.config.duration} ${this.VM.config.planCode}` - const { period } = this.VM.billingPlan.products[key] + const { products = {} } = this.plans.find(({ uuid }) => uuid === this.VM.billingPlan.uuid) ?? {} + const key = this.VM.product ?? `${this.VM.config.duration} ${this.VM.config.planCode}` + const { period } = products[key] ?? {} + const currentPeriod = this.toDate(this.VM.data.expiration) const newPeriod = this.toDate(this.VM.data.expiration + +period) @@ -795,6 +797,11 @@ export default defineComponent({ return tariffs }, + driveSize () { + const { disk, drive_size: size } = this.tariffs[this.planCode].resources + + return (size ?? disk) / 1024 + }, networking () { const { networking } = this.VM?.state?.meta @@ -1116,7 +1123,9 @@ export default defineComponent({ const service = this.services.find(({ uuid }) => uuid === this.VM.uuidService ) - const instance = service.instancesGroups + const newService = JSON.parse(JSON.stringify(service)) + + const instance = newService.instancesGroups .find(({ sp }) => sp === this.VM.sp).instances .find(({ uuid }) => uuid === this.VM.uuid) @@ -1130,15 +1139,15 @@ export default defineComponent({ this.$confirm({ title: this.$t('Do you want to switch tariff?'), - content: `${this.$t('invoice_Price')}: ${price} ${this.currency.code}`, + content: `${this.$t('Tariff price')}: ${price} ${this.currency.code}`, okText: this.$t('Yes'), cancelText: this.$t('Cancel'), onOk: async () => { - await this.updateService(service) + await this.updateService(newService) + await this.sendAction('upgrade') await this.fetch() this.modal.switch = false - this.openNotificationWithIcon('success', { message: this.$t('Done') }) }, onCancel () {} }) @@ -1199,8 +1208,8 @@ export default defineComponent({ data.action = 'backup_restore' data.params = { type: 'full', restorePoint: this.option.recover } } - if (action === 'get_upgrade_price') { - data.params = { newPlanCode: this.planCode } + if (['get_upgrade_price', 'upgrade'].includes(action)) { + data.params = { newPlanCode: this.planCode.split(' ')[1] } } return this.invokeAction(data) diff --git a/src/components/services/custom/index.vue b/src/components/services/custom/index.vue index 6e044a62..a0a825b3 100644 --- a/src/components/services/custom/index.vue +++ b/src/components/services/custom/index.vue @@ -826,7 +826,9 @@ export default { ) const account = access.namespace ?? this.namespace - await this.createInvoice(instance, uuid, account, this.baseURL) + if (this.getProducts.price > 0) { + await this.createInvoice(instance, uuid, account, this.baseURL) + } localStorage.setItem('order', 'Invoice') this.$router.push({ path: '/billing' }) }) diff --git a/src/components/services/virtual/index.vue b/src/components/services/virtual/index.vue index ff6d3e6d..7d05c4cd 100644 --- a/src/components/services/virtual/index.vue +++ b/src/components/services/virtual/index.vue @@ -487,7 +487,9 @@ export default { ) const account = access.namespace ?? this.namespace - await this.createInvoice(instance, uuid, account, this.baseURL) + if (this.getProducts.price > 0) { + await this.createInvoice(instance, uuid, account, this.baseURL) + } localStorage.setItem('order', 'Invoice') this.$router.push({ path: '/billing' }) }) diff --git a/src/routes/cloud/cloudPage.vue b/src/routes/cloud/cloudPage.vue index cc7a7eba..26cbad9f 100644 --- a/src/routes/cloud/cloudPage.vue +++ b/src/routes/cloud/cloudPage.vue @@ -446,7 +446,7 @@ export default { case 'suspended': case 'suspend': case 'pending': - return 'var(--bright_font)' + return 'var(--gloomy_font)' default: return 'var(--err)' }