From ef198786239acd66b1c3f1294a873551bb6bdb67 Mon Sep 17 00:00:00 2001 From: 639852 Date: Mon, 26 Jun 2023 16:23:04 +0400 Subject: [PATCH] - Fixed minor bugs --- src/components/appMain/cloud/cloudItem.vue | 3 ++ .../appMain/invoice/openInvoice.vue | 2 +- .../appMain/invoice/singleInvoice.vue | 2 +- .../modules/ovh dedicated/createInstance.vue | 36 +++++++++++++++++-- src/components/appMain/newPaaS.vue | 7 ++-- .../appMain/ovhCreationTemplate.vue | 7 ++-- src/components/services/iaas/index.vue | 5 +-- src/locales/en.json | 4 +++ 8 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/components/appMain/cloud/cloudItem.vue b/src/components/appMain/cloud/cloudItem.vue index 3b850eaa..a5ba31c0 100644 --- a/src/components/appMain/cloud/cloudItem.vue +++ b/src/components/appMain/cloud/cloudItem.vue @@ -66,6 +66,7 @@ export default { statusColor() { switch (this.instance.domainstatus) { case "RUNNING": + case "Active": return "#0fd058"; // останавливающийся и запускающийся case "BOOT_POWEROFF": @@ -178,7 +179,9 @@ export default { getModuleProductBtn() { const serviceType = this.$config.getServiceType(this.instance.groupname)?.toLowerCase(); const isActive = ['active', 'running'].includes(this.instance.domainstatus?.toLowerCase()); + const sp = this.getSP.find(({ uuid }) => uuid === this.instance.sp); + if (sp?.meta.renew === false) return; if (serviceType === undefined) return; if (this.instance.date === 0) return; if (!isActive && ['virtual', 'iaas'].includes(serviceType)) return; diff --git a/src/components/appMain/invoice/openInvoice.vue b/src/components/appMain/invoice/openInvoice.vue index 3220193d..b0e7848c 100644 --- a/src/components/appMain/invoice/openInvoice.vue +++ b/src/components/appMain/invoice/openInvoice.vue @@ -59,7 +59,7 @@
{{ $t("dueDate") }}
- {{ invoice.duedate | dateFormat }} + {{ (invoice.datepaid ?? invoice.duedate) | dateFormat }}
diff --git a/src/components/appMain/invoice/singleInvoice.vue b/src/components/appMain/invoice/singleInvoice.vue index b9f20f31..1f0794d1 100644 --- a/src/components/appMain/invoice/singleInvoice.vue +++ b/src/components/appMain/invoice/singleInvoice.vue @@ -23,7 +23,7 @@ {{ $t("dueDate") }}
- {{ (invoice.status === 'Unpaid') ? '-' : invoice.duedate }} + {{ (invoice.status === 'Unpaid') ? '-' : (invoice.datepaid ?? invoice.duedate) }}
diff --git a/src/components/appMain/modules/ovh dedicated/createInstance.vue b/src/components/appMain/modules/ovh dedicated/createInstance.vue index fa08cfbb..ccc5ef22 100644 --- a/src/components/appMain/modules/ovh dedicated/createInstance.vue +++ b/src/components/appMain/modules/ovh dedicated/createInstance.vue @@ -65,7 +65,6 @@ export default { let plan = periods[0]; const tarifs = []; - this.options.cpu.size = 1; if (resource.key === 'ram') { this.options.ram.size = parseInt(addonKey?.split('-')[1] ?? 0); } @@ -128,7 +127,7 @@ export default { }, created() { this.$emit('setData', { - key: 'baremetal_datacenter', type: 'ovh', + key: 'dedicated_datacenter', type: 'ovh', value: this.region.value.replace(/\d/g, '').toLowerCase() }); }, @@ -214,6 +213,39 @@ export default { plan(value) { this.price.addons = {}; this.setResources(value); + + setTimeout(() => { + const duration = (this.mode === 'upfront12') ? 'P1Y' : 'P1M'; + const { value } = this.plans.find(({ label }) => label.includes(this.plan)) ?? {}; + const { meta: { addons: allAddons } } = this.getPlan.products[`${duration} ${value}`] ?? + Object.values(this.getPlan.products)[0]; + const addons = []; + + allAddons.forEach(({ id }) => { + const isRamExist = addons.find((addon) => addon.includes('ram')); + const isDiskExist = addons.find((addon) => addon.includes('raid')); + + if (id.includes('ram') && !isRamExist) addons.push(id); + if (id.includes('raid') && !isDiskExist) addons.push(id); + }); + + this.options.cpu.size = 'loading'; + this.$api.post(`/sp/${this.itemSP.uuid}/invoke`, { + method: 'checkout_baremetal', + params: { ...this.options.config, addons } + }) + .then(({ meta: { order: { details } } }) => { + const cpu = details.find(({ description }) => + description.toLowerCase().includes('amd') || + description.toLowerCase().includes('intel') + ); + + this.options.cpu.size = cpu?.description ?? this.$t('No Data'); + }) + .catch(() => { + this.options.cpu.size = this.$t('No Data'); + }); + }); } } } diff --git a/src/components/appMain/newPaaS.vue b/src/components/appMain/newPaaS.vue index 758ce7e6..fb860df3 100644 --- a/src/components/appMain/newPaaS.vue +++ b/src/components/appMain/newPaaS.vue @@ -108,7 +108,7 @@ {{ $t("cpu") }}: @@ -121,7 +121,7 @@ > {{ $t("High speed") }} --> - {{ options.cpu.size }} vCPU + {{ options.cpu.size }} {{ (isNaN(+options.cpu.size)) ? '' : 'vCPU' }} @@ -399,6 +399,9 @@ ref="sum-order" :style="{ 'font-size': '1.4rem', 'margin-top': '10px' }" > + + {{ $t('from') | capitalize }}: + {{ calculatePrice( diff --git a/src/components/appMain/ovhCreationTemplate.vue b/src/components/appMain/ovhCreationTemplate.vue index d10b9404..429870f0 100644 --- a/src/components/appMain/ovhCreationTemplate.vue +++ b/src/components/appMain/ovhCreationTemplate.vue @@ -50,14 +50,17 @@ CPU: - {{ options.cpu.size }} vCPU + + RAM: - +
Loading...
@@ -376,8 +376,9 @@ export default { if (typeof product.description !== 'string') return product if (/<\/?[a-z][\s\S]*>/i.test(product.description)) { if (typeof product.price?.currency === 'string') return product + console.log(product); - if (product.paytype === 'free') { + if (product.paytype === 'free' || !product.price) { product.price = { value: 0, currency: '' } } else if (product.paytype === 'onetime') { product.price = { value: product.price.monthly, currency: '' } diff --git a/src/locales/en.json b/src/locales/en.json index 95327106..416494e1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -46,6 +46,7 @@ "dueDate": "Payment Date", "Choice payment": "Choose payment", "one time payment": "one time payment", + "recurring payment": "recurring payment", "Information": "Information", "Copy link": "Copy link", "Copy link to share": "Copy link to share", @@ -101,6 +102,7 @@ "With discount": "With discount", "you will pay:": "you will pay:", "Actual price may vary": "Actual price may vary", + "choose addons you want": "choose addons you want", "prices": "prices", "Tariff price": "Tariff price", "Addons prices": "Addons prices", @@ -179,6 +181,8 @@ "go to invoice": "Go to Order", "increases core frequency from 2.4 GHz to 3.7 GHz": "increases core frequency from 2.4 GHz to 3.7 GHz", "renew automatically": "renew automatically", + "Automatic renewal": "Automatic renewal", + "Manual renewal": "Manual renewal", "Virtual machine will be available after paying the invoice": "Virtual machine will be available after paying the order", "Session will be created in a few seconds": "Session will be created in a few seconds", "Deploy": "Deploy",