Skip to content

Commit

Permalink
fix(pci): null instance price (#3864)
Browse files Browse the repository at this point in the history
`CucPriceHelper.getPrices` is throwing an error, that wasn't catched in the
routing causing the whole instance page to be in error.

ref: DTRSD-22103

Signed-off-by: frenauvh <[email protected]>
  • Loading branch information
frenautvh authored Oct 19, 2020
1 parent 3b66c5d commit cd62472
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
</div>

<oui-tile-definition
data-ng-if="$ctrl.instancePrice.price"
data-term="{{:: 'pci_projects_project_instances_instance_price_label' | translate }}"
>
<oui-tile-description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,20 @@ export default class PciProjectInstanceService {
}

getInstancePrice(projectId, instance) {
return this.CucPriceHelper.getPrices(projectId).then((prices) => {
const price = prices[instance.planCode];
// Set 3 digits for hourly price
if (!instance.isMonthlyBillingActivated()) {
price.price.text = price.price.text.replace(
/\d+(?:[.,]\d+)?/,
`${price.price.value.toFixed(3)}`,
);
}
return this.CucPriceHelper.getPrices(projectId)
.then((prices) => {
const price = prices[instance.planCode];
// Set 3 digits for hourly price
if (!instance.isMonthlyBillingActivated()) {
price.price.text = price.price.text.replace(
/\d+(?:[.,]\d+)?/,
`${price.price.value.toFixed(3)}`,
);
}

return price;
});
return price;
})
.catch(() => null);
}

getProjectQuota(projectId, region = null) {
Expand Down

0 comments on commit cd62472

Please sign in to comment.