Skip to content

Commit

Permalink
Merge pull request #1395 from slntopp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dimquaa authored Dec 29, 2023
2 parents b7d79a8 + 9b30bc1 commit 37845da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
20 changes: 5 additions & 15 deletions admin-ui/src/components/modules/keyweb/billingInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,11 @@ watch(accountRate, () => {
});
const addons = computed(() => {
return Object.keys(props.template.config?.configurations || {})
.map((key) => {
const resIndex = props.template.billingPlan?.resources?.findIndex((r) => {
return (
r.key === getAddonKey(key, "addons") ||
r.key === getAddonKey(key, "os")
);
});
return Object.values(props.template.config?.configurations || {})
.map((val) => {
const resIndex = props.template.billingPlan?.resources?.findIndex(
(r) => r.key === [val, template.value.product].join("$")
);
if (resIndex !== -1) {
const res = props.template.billingPlan?.resources[resIndex];
return {
Expand All @@ -184,13 +181,6 @@ const addons = computed(() => {
.filter((a) => !!a);
});
const getAddonKey = (key, metaKey) =>
billingPlan.value.products[template.value.product]?.meta?.[metaKey].find(
(a) =>
key === a.type &&
a.key.startsWith(props.template.config?.configurations[key])
)?.key;
const getBillingItems = () => {
const items = [];
const product = billingPlan.value.products[template.value.product];
Expand Down
18 changes: 5 additions & 13 deletions admin-ui/src/components/modules/keyweb/billingLabel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,14 @@ const dueDate = computed(() => {
const instancePrice = computed(() => {
const key = props.template.product;
const tariff = props.template.billingPlan.products[key];
const getAddonKey = (key, metaKey) =>
tariff.meta?.[metaKey].find(
(a) =>
key === a.type &&
a.key.startsWith(props.template.config?.configurations[key])
)?.key;
const getAddonKey = (addon) =>
[props.template.config?.configurations[addon], key].join("$");
const addons = Object.keys(props.template.config?.configurations || {}).map(
(key) =>
props.template.billingPlan?.resources?.find((r) => {
return (
r.key === getAddonKey(key, "addons") ||
r.key === getAddonKey(key, "os")
);
})
props.template.billingPlan?.resources?.find(
(r) => r.key === getAddonKey(key)
)
);
return (
Expand Down

0 comments on commit 37845da

Please sign in to comment.