Skip to content

Commit

Permalink
fix: not called savings plan check for us (#13719)
Browse files Browse the repository at this point in the history
ref: INC0085370
Signed-off-by: Lionel Bueno <[email protected]>
  • Loading branch information
lionel95200x authored Oct 24, 2024
1 parent fc9d66d commit fe519bf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default {
trackPage: '<',
isDiscoveryProject: '<',
projectId: '<',
pciFeatures: '<',
},
controller,
template,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SUPPORT_URL } from '../../../new/constants';
import { PCI_FEATURES } from '../../project.constants';
import { MESSAGES_CONTAINER_NAME } from '../edit.constant';

export default class {
Expand Down Expand Up @@ -42,18 +43,31 @@ export default class {
});
}

isSavingsPlanAvailable() {
return this.pciFeatures.isFeatureAvailable(
PCI_FEATURES.PRODUCTS.SAVINGS_PLAN,
);
}

checkSavingsPlan(serviceId) {
this.$http({
url: `/services/${serviceId}/savingsPlans/subscribed`,
}).then(({ data }) => {
this.isLoading = false;
if (data.length) {
const activePlan = data.some((p) => p.status === 'ACTIVE');
if (activePlan) {
this.canDeleteProject = false;
}
}
});
if (this.isSavingsPlanAvailable()) {
this.$http({
url: `/services/${serviceId}/savingsPlans/subscribed`,
})
.then(({ data }) => {
this.isLoading = false;
if (data.length) {
const activePlan = data.some((p) => p.status === 'ACTIVE');
if (activePlan) {
this.canDeleteProject = false;
}
}
})
.catch(() => {
this.isLoading = false;
});
}
this.isLoading = false;
}

getTranslationKey() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const PCI_FEATURES = {
HORIZON: 'horizon',
PUBLIC_GATEWAYS: 'public-gateways',
DATA_PLATFORM: 'data-platform',
SAVINGS_PLAN: 'pci-savings-plan',
},
INSTANCE_FLAVORS_CATEGORY: {
GENERAL: 'instance:flavors-category-general',
Expand Down

0 comments on commit fe519bf

Please sign in to comment.