Skip to content

Commit

Permalink
Merge pull request #213 from Support-pl/dev
Browse files Browse the repository at this point in the history
fixed minor bugs
  • Loading branch information
639852 committed Jun 26, 2023
2 parents f9ab706 + ef19878 commit 8678c8a
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/components/appMain/cloud/cloudItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default {
statusColor() {
switch (this.instance.domainstatus) {
case "RUNNING":
case "Active":
return "#0fd058";
// останавливающийся и запускающийся
case "BOOT_POWEROFF":
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/components/appMain/invoice/openInvoice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<div class="info__date-item">
<div class="info__date-title">{{ $t("dueDate") }}</div>
<div class="info__date-value">
{{ invoice.duedate | dateFormat }}
{{ (invoice.datepaid ?? invoice.duedate) | dateFormat }}
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/appMain/invoice/singleInvoice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{ $t("dueDate") }}
</div>
<div class="invoice__date">
{{ (invoice.status === 'Unpaid') ? '-' : invoice.duedate }}
{{ (invoice.status === 'Unpaid') ? '-' : (invoice.datepaid ?? invoice.duedate) }}
</div>
</div>
</div>
Expand Down
36 changes: 34 additions & 2 deletions src/components/appMain/modules/ovh dedicated/createInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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()
});
},
Expand Down Expand Up @@ -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');
});
});
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/components/appMain/newPaaS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<a-row
type="flex"
justify="space-between"
v-if="options.cpu.size"
v-if="options.cpu.size && options.cpu.size !== 'loading'"
:style="{ 'font-size': '1.2rem', 'align-items': 'center' }"
>
<a-col> {{ $t("cpu") }}: </a-col>
Expand All @@ -121,7 +121,7 @@
>
{{ $t("High speed") }}
</a-col> -->
<a-col>{{ options.cpu.size }} vCPU</a-col>
<a-col>{{ options.cpu.size }} {{ (isNaN(+options.cpu.size)) ? '' : 'vCPU' }}</a-col>
</a-row>
</transition>

Expand Down Expand Up @@ -399,6 +399,9 @@
ref="sum-order"
:style="{ 'font-size': '1.4rem', 'margin-top': '10px' }"
>
<a-col style="margin-right: 4px" v-if="activeKey === 'location'">
{{ $t('from') | capitalize }}:
</a-col>
<transition name="textchange" mode="out-in">
<a-col v-if="tarification === 'Annually'" key="a">
{{ calculatePrice(
Expand Down
7 changes: 5 additions & 2 deletions src/components/appMain/ovhCreationTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,17 @@
<span style="display: inline-block; width: 70px">CPU:</span>
</a-col>
<a-col class="changing__field" style="text-align: right">
{{ options.cpu.size }} vCPU
<a-icon v-if="options.cpu.size === 'loading'" type="loading" />
<template v-else>
{{ options.cpu.size }} {{ (isNaN(+options.cpu.size)) ? '' : 'vCPU' }}
</template>
</a-col>
</a-row>
<a-row type="flex" justify="space-between" align="middle" class="newCloud__prop">
<a-col>
<span style="display: inline-block; width: 70px">RAM:</span>
</a-col>
<a-col :sm="{ span: 18, order: 0 }" :xs="{ span: 24, order: 1 }" v-if="resources.ram.length > 1">
<a-col :sm="{ span: 18, order: 0 }" :xs="{ span: 24, order: 1 }" v-if="resources.ram.length > 1">
<a-slider
style="margin-top: 10px"
:marks="{ ...resources.ram }"
Expand Down
5 changes: 3 additions & 2 deletions src/components/services/iaas/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<a-card
style="margin-top: 15px"
v-if="fetchLoading || addons[getProducts.id] && addons[getProducts.id].length > 0"
:title="$t('Addons')"
:title="`${$t('Addons')} (${$t('choose addons you want')})`"
:loading="fetchLoading"
>
<div v-if="fetchLoading">Loading...</div>
Expand Down Expand Up @@ -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: '' }
Expand Down
4 changes: 4 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 8678c8a

Please sign in to comment.