Skip to content

Commit

Permalink
Merge pull request #1979 from slntopp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SazukinPavel authored Jan 22, 2025
2 parents a21fda7 + 0e57857 commit 57d7b84
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
3 changes: 2 additions & 1 deletion admin-ui/src/components/modules/ione/planConfiguration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<v-select
label="Preferred disk type"
:items="['HDD', 'SSD']"
v-model="meta.preferedDiskType"
:value="meta.preferedDiskType"
@change="meta.preferedDiskType = $event || undefined"
clearable
/>
</v-col>
Expand Down
32 changes: 24 additions & 8 deletions admin-ui/src/views/PlansCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
:is="template"
:rules="rules"
:type="plan.type"
:resources="plan.resources"
:resources="resources"
:addons="plan.addons"
:products="filteredProducts"
@change:resource="(data) => changeConfig(data, 'resource')"
Expand Down Expand Up @@ -408,10 +408,15 @@ export default {
this.plan[type][id].descriptionId = descriptionId;
});
const request =
action === "edit"
? api.plans.update(id, this.plan)
: api.plans.create(this.plan);
let request;
if (action == "edit") {
request = api.plans.update(id, this.plan);
} else {
request = api.plans.create({
...this.plan,
title: `${this.plan.title} COPY`,
});
}
const data = await request;
if (bindPlan) {
Expand Down Expand Up @@ -522,7 +527,7 @@ export default {
}
if (matched[1] === "ione") {
this.types.push("ione", "ione-vpn",);
this.types.push("ione", "ione-vpn");
}
if (matched[1] === "empty") {
Expand Down Expand Up @@ -557,7 +562,15 @@ export default {
return hidden.some((h) => this.plan.type?.includes(h));
},
filteredProducts() {
return this.plan.products;
const products = JSON.parse(JSON.stringify(this.plan.products || {}));
Object.keys(products).forEach((key) => {
if (!products[key].price) {
products[key].price = 0;
}
});
return products;
},
downloadedFileName() {
return this.plan.title
Expand Down Expand Up @@ -610,7 +623,10 @@ export default {
return this.plan.status === "DEL";
},
resources() {
return this.plan.resources || [];
return (this.plan.resources || []).map((r) => ({
...r,
price: r.price || 0,
}));
},
},
watch: {
Expand Down

0 comments on commit 57d7b84

Please sign in to comment.