Skip to content

Commit

Permalink
fix(dedicated): add featureAvailibility to upd protocol on lb frontend (
Browse files Browse the repository at this point in the history
#13187)

ref: MANAGER-15224

Signed-off-by: soufien mhelhali <[email protected]>
  • Loading branch information
mhelhali-soufien authored Sep 22, 2024
1 parent cc7a4e2 commit dc3fbf0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/manager/modules/iplb/src/frontends/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ngOvhFeatureFlipping from '@ovh-ux/ng-ovh-feature-flipping';

import IpLoadBalancerDashboardHeaderCtrl from '../header/iplb-dashboard-header.controller';
import IpLoadBalancerFrontendsCtrl from './iplb-frontends.controller';
import IpLoadBalancerFrontendDeleteCtrl from './delete/iplb-frontends-delete.controller';
Expand All @@ -10,9 +12,10 @@ import IplbFrontendsTemplate from './iplb-frontends.html';
import IplbHeaderTemplate from '../header/iplb-dashboard-header.html';

const moduleName = 'ovhManagerIplbFrontends';
const LB_FRONTEND_UDP_AVAILABILITY = 'lb-frontend-udp';

angular
.module(moduleName, ['ui.router'])
.module(moduleName, ['ui.router', ngOvhFeatureFlipping])
.config(
/* @ngInject */ ($stateProvider) => {
$stateProvider
Expand Down Expand Up @@ -59,6 +62,12 @@ angular
resolve: {
breadcrumb: /* @ngInject */ ($translate) =>
$translate.instant('iplb_frontends_add'),
udpAvailability: /* @ngInject */ (ovhFeatureFlipping) =>
ovhFeatureFlipping
.checkFeatureAvailability(LB_FRONTEND_UDP_AVAILABILITY)
.then((feature) =>
feature.isFeatureAvailable(LB_FRONTEND_UDP_AVAILABILITY),
),
},
})
.state('iplb.detail.frontends.update', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class IpLoadBalancerFrontendsEditCtrl {
IpLoadBalancerFailoverIpService,
IpLoadBalancerFrontendsService,
IpLoadBalancerZoneService,
udpAvailability,
) {
this.$q = $q;
this.$state = $state;
Expand All @@ -29,6 +30,7 @@ export default class IpLoadBalancerFrontendsEditCtrl {
this.IpLoadBalancerFailoverIpService = IpLoadBalancerFailoverIpService;
this.IpLoadBalancerFrontendsService = IpLoadBalancerFrontendsService;
this.IpLoadBalancerZoneService = IpLoadBalancerZoneService;
this.udpAvailability = udpAvailability;

this.initLoaders();
}
Expand Down Expand Up @@ -187,6 +189,10 @@ export default class IpLoadBalancerFrontendsEditCtrl {
} else {
this.farms.load();
}

if (!this.udpAvailability) {
this.protocols = this.protocols.filter((protocol) => protocol !== 'udp');
}
}

static validateSelection(value) {
Expand Down

0 comments on commit dc3fbf0

Please sign in to comment.