diff --git a/src/components/appMain/modules/ione/createInstance.vue b/src/components/appMain/modules/ione/createInstance.vue index 1667c850..dd19238d 100644 --- a/src/components/appMain/modules/ione/createInstance.vue +++ b/src/components/appMain/modules/ione/createInstance.vue @@ -442,11 +442,14 @@ export default { watch: { plans() { const value = []; + const types = new Set(); const day = 3600 * 24 const month = day * 30; const year = day * 365; this.plans.forEach((plan) => { + types.add(plan.type); + if (plan.kind === 'DYNAMIC') value.push( { value: 'Hourly', label: 'ssl_product.Hourly' } ); @@ -470,6 +473,8 @@ export default { { value: 'Biennially', label: 'biennially', period: year * 2 } ); }); + + if (types.size > 1) return; value.sort((a, b) => (a.value === 'Hourly') ? 1 : a.period - b.period); this.options.drive = false; diff --git a/src/components/appMain/modules/ovh cloud/createInstance.vue b/src/components/appMain/modules/ovh cloud/createInstance.vue index 5240cc46..7135d028 100644 --- a/src/components/appMain/modules/ovh cloud/createInstance.vue +++ b/src/components/appMain/modules/ovh cloud/createInstance.vue @@ -89,6 +89,8 @@ export default { this.$emit('setData', { key: 'priceOVH', value: this.price }); this.$emit('setData', { key: 'planCode', value, type: 'ovh' }); this.$emit('setData', { key: 'monthlyBilling', value: (plan.duration === 'P1M'), type: 'ovh' }); + this.$emit('setData', { key: 'duration', value: plan.duration, type: 'ovh' }); + this.$emit('setData', { key: 'pricingMode', value: plan.pricingMode, type: 'ovh' }); }, setPlans(value) { this.plans = value.sort((a, b) => diff --git a/src/components/appMain/newPaaS.vue b/src/components/appMain/newPaaS.vue index 8f9ecbc0..a149d9df 100644 --- a/src/components/appMain/newPaaS.vue +++ b/src/components/appMain/newPaaS.vue @@ -399,7 +399,7 @@ ref="sum-order" :style="{ 'font-size': '1.4rem', 'margin-top': '10px' }" > - + {{ $t('from') | capitalize }}: @@ -824,10 +824,11 @@ export default { //--------------Plans----------------- filteredPlans() { - const { billing_plans = [] } = (this.itemSP.meta.showcase ?? {})[this.showcase] ?? {}; + const locationItem = this.locations.find((el) => el.id === this.locationId); - if (billing_plans.length < 1) return this.getPlans; - return this.getPlans.filter(({ uuid }) => billing_plans?.includes(uuid)); + return this.getPlans.filter(({ type }) => + (locationItem.type) ? locationItem.type === type : true + ); }, //UNKNOWN and STATIC getPlan() { @@ -1321,6 +1322,8 @@ export default { newGroup.config = { ssh: newInstance.config.ssh }; delete newInstance.config.ssh; } + + delete newInstance.product; } if (this.itemService?.instancesGroups?.length < 1) { this.itemService.instancesGroups = [newGroup]; @@ -1625,13 +1628,18 @@ export default { anonymously: !this.isLoggedIn }) .then(({ pool }) => { - const showcase = Object.keys(this.itemSP.meta.showcase ?? {}) - .find((key) => key === this.$route.query.service) ?? - Object.keys(this.itemSP.meta.showcase ?? {})[0]; + this.$store.commit('nocloud/plans/setPlans', pool); + + const keys = Object.entries(this.itemSP.meta.showcase ?? {}); + const [showcase] = keys.find(([key, { billing_plans }]) => { + const plan = this.filteredPlans.find(({ uuid }) => billing_plans.includes(uuid)); + + return key === this.$route.query.service || plan; + }) ?? keys[0]; + const plans = this.itemSP.meta.showcase[showcase]?.billing_plans ?? []; - const uuid = plans.find((el) => pool.find((plan) => el === plan.uuid)); + const uuid = plans.find((el) => this.filteredPlans.find((plan) => el === plan.uuid)); - this.$store.commit('nocloud/plans/setPlans', pool); this.plan = uuid ?? pool[0]?.uuid ?? ''; if (this.dataLocalStorage.billing_plan) {