diff --git a/packages/manager/modules/pci/src/projects/project/edit/remove/remove.component.js b/packages/manager/modules/pci/src/projects/project/edit/remove/remove.component.js index 43b9301e0fec..f9dd61ebb7bb 100644 --- a/packages/manager/modules/pci/src/projects/project/edit/remove/remove.component.js +++ b/packages/manager/modules/pci/src/projects/project/edit/remove/remove.component.js @@ -11,6 +11,7 @@ export default { trackPage: '<', isDiscoveryProject: '<', projectId: '<', + pciFeatures: '<', }, controller, template, diff --git a/packages/manager/modules/pci/src/projects/project/edit/remove/remove.controller.js b/packages/manager/modules/pci/src/projects/project/edit/remove/remove.controller.js index 44973d36d6e7..cf40f1c8132f 100644 --- a/packages/manager/modules/pci/src/projects/project/edit/remove/remove.controller.js +++ b/packages/manager/modules/pci/src/projects/project/edit/remove/remove.controller.js @@ -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 { @@ -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() { diff --git a/packages/manager/modules/pci/src/projects/projects.constant.js b/packages/manager/modules/pci/src/projects/projects.constant.js index cc98f29613a7..c6f48d815828 100644 --- a/packages/manager/modules/pci/src/projects/projects.constant.js +++ b/packages/manager/modules/pci/src/projects/projects.constant.js @@ -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',