diff --git a/packages/manager/modules/iplb/src/home/index.js b/packages/manager/modules/iplb/src/home/index.js
index 0a9adbe612f4..c8ef4e8a4fb2 100644
--- a/packages/manager/modules/iplb/src/home/index.js
+++ b/packages/manager/modules/iplb/src/home/index.js
@@ -7,7 +7,7 @@ import IpLoadBalancerHomeService from './iplb-home.service';
import IpLoadBalancerHomeStatusService from './iplb-home-status.service';
import IpLoadBalancerUpdateQuotaCtrl from './updateQuota/iplb-update-quota.controller';
import IplbBulletChartComponent from './bullet-chart.component';
-
+import IpLoadBalancerTerminateCtrl from '../modal/terminate/terminate.controller';
import IplbHeaderTemplate from '../header/iplb-dashboard-header.html';
import IplbHomeTemplate from './iplb-home.html';
@@ -15,6 +15,8 @@ import './bullet-chart.less';
import './status-card.less';
import './home.less';
+import { LB_DELETE_FEATURE } from './iplb-home.constants';
+
const moduleName = 'ovhManagerIplbHome';
angular
@@ -41,6 +43,14 @@ angular
},
resolve: {
breadcrumb: () => null,
+ isDeleteOptionsAvailable: /* @ngInject */ (ovhFeatureFlipping) => {
+ return ovhFeatureFlipping
+ .checkFeatureAvailability([LB_DELETE_FEATURE])
+ .then((featureAvailability) =>
+ featureAvailability.isFeatureAvailable(LB_DELETE_FEATURE),
+ )
+ .catch(() => false);
+ },
},
});
},
@@ -53,6 +63,7 @@ angular
.controller('IpLoadBalancerHomeCtrl', IpLoadBalancerHomeCtrl)
.service('IpLoadBalancerHomeStatusService', IpLoadBalancerHomeStatusService)
.controller('IpLoadBalancerUpdateQuotaCtrl', IpLoadBalancerUpdateQuotaCtrl)
+ .controller('IpLoadBalancerTerminateCtrl', IpLoadBalancerTerminateCtrl)
.directive('iplbBulletChart', IplbBulletChartComponent)
.run(/* @ngTranslationsInject:json ./translations */);
diff --git a/packages/manager/modules/iplb/src/home/iplb-home.constants.js b/packages/manager/modules/iplb/src/home/iplb-home.constants.js
index 00a00cee0432..72919f69bba2 100644
--- a/packages/manager/modules/iplb/src/home/iplb-home.constants.js
+++ b/packages/manager/modules/iplb/src/home/iplb-home.constants.js
@@ -25,6 +25,7 @@ export const MESSAGE_DISPLAY_DATE = '2023-04-01';
export const LB_TEMPORARY_WARNING_BANNER_FEATURE =
'ip-load-balancer:lb-temporary-warning-banner';
+export const LB_DELETE_FEATURE = 'ip-load-balancer:delete';
export const LB_SUBSCRIPTION_CONTACT_SECTION =
'ip-load-balancer:lb-contact-section';
@@ -33,5 +34,6 @@ export default {
INFO_LINK,
MESSAGE_DISPLAY_DATE,
LB_TEMPORARY_WARNING_BANNER_FEATURE,
+ LB_DELETE_FEATURE,
LB_SUBSCRIPTION_CONTACT_SECTION,
};
diff --git a/packages/manager/modules/iplb/src/home/iplb-home.controller.js b/packages/manager/modules/iplb/src/home/iplb-home.controller.js
index 0f60679fd655..45fdabc6d5d2 100644
--- a/packages/manager/modules/iplb/src/home/iplb-home.controller.js
+++ b/packages/manager/modules/iplb/src/home/iplb-home.controller.js
@@ -8,6 +8,7 @@ import map from 'lodash/map';
import 'moment';
import IplbHomeUpdateQuotaTemplate from './updateQuota/iplb-update-quota.html';
+import IpLoadBalancerTerminateTemplate from '../modal/terminate/terminate.html';
import {
INFO_LINK,
MESSAGE_DISPLAY_DATE,
@@ -40,6 +41,7 @@ export default class IpLoadBalancerHomeCtrl {
ovhManagerRegionService,
CucVrackService,
ovhFeatureFlipping,
+ isDeleteOptionsAvailable,
) {
this.$http = $http;
this.$state = $state;
@@ -63,6 +65,7 @@ export default class IpLoadBalancerHomeCtrl {
this.ovhManagerRegionService = ovhManagerRegionService;
this.VrackService = CucVrackService;
this.ovhFeatureFlipping = ovhFeatureFlipping;
+ this.isDeleteOptionsAvailable = isDeleteOptionsAvailable;
this.serviceName = this.$stateParams.serviceName;
@@ -247,6 +250,24 @@ export default class IpLoadBalancerHomeCtrl {
text: this.$translate.instant('iplb_edit'),
isAvailable: () => false,
},
+ deleteService: {
+ callback: () =>
+ this.CucControllerHelper.modal.showModal({
+ modalConfig: {
+ template: IpLoadBalancerTerminateTemplate,
+ controller: 'IpLoadBalancerTerminateCtrl',
+ controllerAs: '$ctrl',
+ resolve: {
+ service: () => this,
+ },
+ },
+ }),
+ text: this.$translate.instant('iplb_delete'),
+ isAvailable: () =>
+ this.isDeleteOptionsAvailable &&
+ !this.subscription.loading &&
+ !this.subscription.hasErrors,
+ },
manageAutorenew: {
text: this.$translate.instant('iplb_manage'),
href: this.coreURLBuilder.buildURL('dedicated', '#/billing/autoRenew', {
diff --git a/packages/manager/modules/iplb/src/home/iplb-home.html b/packages/manager/modules/iplb/src/home/iplb-home.html
index e80ed013b2c3..2a9719f98a4a 100644
--- a/packages/manager/modules/iplb/src/home/iplb-home.html
+++ b/packages/manager/modules/iplb/src/home/iplb-home.html
@@ -393,6 +393,15 @@
data-ng-bind="::$ctrl.actions.manageAutorenew.text"
>
+
+
+
{
$stateProvider
diff --git a/packages/manager/modules/iplb/src/iplb.module.js b/packages/manager/modules/iplb/src/iplb.module.js
index 7709ad93e9b3..097d4e3bc374 100644
--- a/packages/manager/modules/iplb/src/iplb.module.js
+++ b/packages/manager/modules/iplb/src/iplb.module.js
@@ -7,19 +7,15 @@ import ngTranslateAsyncLoader from '@ovh-ux/ng-translate-async-loader';
import { ListLayoutHelper } from '@ovh-ux/manager-ng-layout-helpers';
import ngOvhFeatureFlipping from '@ovh-ux/ng-ovh-feature-flipping';
-import routing from './iplb.routing';
-
const moduleName = 'ovhManagerIpLoadBalancer';
-angular
- .module(moduleName, [
- ngOvhFeatureFlipping,
- ngTranslateAsyncLoader,
- 'oui',
- 'pascalprecht.translate',
- 'ovhManagerFilters',
- ListLayoutHelper.moduleName,
- ])
- .config(routing);
+angular.module(moduleName, [
+ ngOvhFeatureFlipping,
+ ngTranslateAsyncLoader,
+ 'oui',
+ 'pascalprecht.translate',
+ 'ovhManagerFilters',
+ ListLayoutHelper.moduleName,
+]);
export default moduleName;
diff --git a/packages/manager/modules/iplb/src/listing/constants.js b/packages/manager/modules/iplb/src/listing/constants.js
new file mode 100644
index 000000000000..b7058c5de841
--- /dev/null
+++ b/packages/manager/modules/iplb/src/listing/constants.js
@@ -0,0 +1,19 @@
+export const DEFAULT_NUMBER_OF_COLUMNS = 4;
+
+export const STRING_COLUMN_OPTIONS = [
+ 'contains',
+ 'startsWith',
+ 'endsWith',
+ 'is',
+ 'isNot',
+];
+
+export const NUMBER_COLUMN_OPTIONS = ['is'];
+export const LB_DELETE_FEATURE = 'ip-load-balancer:delete';
+
+export default {
+ DEFAULT_NUMBER_OF_COLUMNS,
+ NUMBER_COLUMN_OPTIONS,
+ STRING_COLUMN_OPTIONS,
+ LB_DELETE_FEATURE,
+};
diff --git a/packages/manager/modules/iplb/src/listing/index.js b/packages/manager/modules/iplb/src/listing/index.js
new file mode 100644
index 000000000000..1d19bb0777ae
--- /dev/null
+++ b/packages/manager/modules/iplb/src/listing/index.js
@@ -0,0 +1,19 @@
+import angular from 'angular';
+import '@uirouter/angularjs';
+import '@ovh-ux/ui-kit';
+import '@ovh-ux/manager-core';
+
+import IpLoadBalancerTerminateCtrl from '../modal/terminate/terminate.controller';
+import iplbListing from './listing.component';
+import route from './listing.route';
+
+const moduleName = 'iplbListing';
+
+angular
+ .module(moduleName, ['oui', 'ui.router', 'ovhManagerCore'])
+ .controller('IpLoadBalancerTerminateCtrl', IpLoadBalancerTerminateCtrl)
+ .component('iplbListing', iplbListing)
+ .config(route)
+ .run(/* @ngTranslationsInject:json ./translations */);
+
+export default moduleName;
diff --git a/packages/manager/modules/iplb/src/listing/listing.component.js b/packages/manager/modules/iplb/src/listing/listing.component.js
new file mode 100644
index 000000000000..f0c9234fef18
--- /dev/null
+++ b/packages/manager/modules/iplb/src/listing/listing.component.js
@@ -0,0 +1,25 @@
+import { ListLayoutHelper } from '@ovh-ux/manager-ng-layout-helpers';
+import controller from './listing.controller';
+import template from './listing.html';
+
+export default {
+ bindings: {
+ ...ListLayoutHelper.componentBindings,
+ header: '<',
+ staticResources: '',
+ id: '@',
+ description: '<',
+ loadResource: '',
+ columns: '<',
+ customizableColumns: '',
+ defaultFilterColumn: '<',
+ getServiceNameLink: '',
+ options: '',
+ formatters: '',
+ topbarOptions: '',
+ customizeColumnsMap: '',
+ isDeleteOptionsAvailable: '<',
+ },
+ template,
+ controller,
+};
diff --git a/packages/manager/modules/iplb/src/listing/listing.controller.js b/packages/manager/modules/iplb/src/listing/listing.controller.js
new file mode 100644
index 000000000000..5abd980cacae
--- /dev/null
+++ b/packages/manager/modules/iplb/src/listing/listing.controller.js
@@ -0,0 +1,36 @@
+import { ListLayoutHelper } from '@ovh-ux/manager-ng-layout-helpers';
+import template from '../modal/terminate/terminate.html';
+
+export default class iplbListingCtrl extends ListLayoutHelper.ListLayoutCtrl {
+ /* @ngInject */
+ constructor($state, $q, Alerter, ouiDatagridService, CucControllerHelper) {
+ super($q, ouiDatagridService);
+ this.$state = $state;
+ this.ouiDatagridService = ouiDatagridService;
+ this.CucControllerHelper = CucControllerHelper;
+ this.Alerter = Alerter;
+ }
+
+ $onInit() {
+ super.$onInit();
+ console.log(this.Alerter);
+ this.Alerter.error('test test test', 'InfoErrors');
+ }
+
+ gotoService({ serviceName }) {
+ this.$state.go('iplb.detail.home', { serviceName });
+ }
+
+ deleteIplb(service) {
+ this.CucControllerHelper.modal.showModal({
+ modalConfig: {
+ template,
+ controller: 'IpLoadBalancerTerminateCtrl',
+ controllerAs: '$ctrl',
+ resolve: {
+ service: () => service,
+ },
+ },
+ });
+ }
+}
diff --git a/packages/manager/modules/iplb/src/listing/listing.html b/packages/manager/modules/iplb/src/listing/listing.html
new file mode 100644
index 000000000000..1f9eb7fc4b7f
--- /dev/null
+++ b/packages/manager/modules/iplb/src/listing/listing.html
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/manager/modules/iplb/src/iplb.routing.js b/packages/manager/modules/iplb/src/listing/listing.route.js
similarity index 69%
rename from packages/manager/modules/iplb/src/iplb.routing.js
rename to packages/manager/modules/iplb/src/listing/listing.route.js
index 399d299093ef..91020823360b 100644
--- a/packages/manager/modules/iplb/src/iplb.routing.js
+++ b/packages/manager/modules/iplb/src/listing/listing.route.js
@@ -1,11 +1,12 @@
import { ListLayoutHelper } from '@ovh-ux/manager-ng-layout-helpers';
+import { LB_DELETE_FEATURE } from './constants';
export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('iplb.index', {
url: `?${ListLayoutHelper.urlQueryParams}`,
views: {
iplbContainer: {
- component: 'managerListLayout',
+ component: 'iplbListing',
},
},
params: ListLayoutHelper.stateParams,
@@ -14,13 +15,21 @@ export default /* @ngInject */ ($stateProvider) => {
apiPath: () => '/ipLoadbalancing',
dataModel: () => 'ipLoadbalancing.Ip',
defaultFilterColumn: () => 'serviceName',
- header: /* @ngInject */ ($translate) => $translate.instant('iplb_title'),
- customizableColumns: () => true,
getServiceNameLink: /* @ngInject */ ($state) => ({ serviceName }) =>
$state.href('iplb.detail', {
serviceName,
}),
+ breadcrumb: () => null,
hideBreadcrumb: () => true,
+ isDeleteOptionsAvailable: /* @ngInject */ (ovhFeatureFlipping) => {
+ return ovhFeatureFlipping
+ .checkFeatureAvailability([LB_DELETE_FEATURE])
+ .then((featureAvailability) =>
+ featureAvailability.isFeatureAvailable(LB_DELETE_FEATURE),
+ )
+ .catch(() => false);
+ },
+ header: /* @ngInject */ ($translate) => $translate.instant('iplb_title'),
},
redirectTo: (transition) =>
transition
diff --git a/packages/manager/modules/iplb/src/listing/translations/Messages_fr_FR.json b/packages/manager/modules/iplb/src/listing/translations/Messages_fr_FR.json
new file mode 100644
index 000000000000..f28fab5e4d9a
--- /dev/null
+++ b/packages/manager/modules/iplb/src/listing/translations/Messages_fr_FR.json
@@ -0,0 +1,11 @@
+{
+ "iplb_listing_action_delete": "Supprimer mon service",
+ "iplb_listing_action_detail": "Voir les details de mon service",
+ "iplb_terminate_service": "Supprimer mon service",
+ "iplb_terminate_service_warning": "Veuillez confirmer la suppression de votre service",
+ "iplb_terminate_service_success": "Votre demande de suppression de votre service a été prise en compte. Un e-mail contenant la procédure vous a été envoyé.",
+ "iplb_terminate_service_error": "Une erreur est survenue lors de la demande de suppression de votre service. {{error}}",
+ "iplb_terminate_service_confirm_input": "Entrez \"TERMINATE\" dans le champ ci-dessous pour confirmer",
+ "iplb_terminate_service_terminate_valide": "Valider",
+ "iplb_terminate_service_terminate_cancel": "Annuler"
+}
diff --git a/packages/manager/modules/iplb/src/modal/terminate/constants.js b/packages/manager/modules/iplb/src/modal/terminate/constants.js
new file mode 100644
index 000000000000..203add1344d7
--- /dev/null
+++ b/packages/manager/modules/iplb/src/modal/terminate/constants.js
@@ -0,0 +1,5 @@
+export const TERMINATE_PATTERN = /^TERMINATE$/;
+
+export default {
+ TERMINATE_PATTERN,
+};
diff --git a/packages/manager/modules/iplb/src/modal/terminate/terminate.controller.js b/packages/manager/modules/iplb/src/modal/terminate/terminate.controller.js
new file mode 100644
index 000000000000..fe138fe0ffef
--- /dev/null
+++ b/packages/manager/modules/iplb/src/modal/terminate/terminate.controller.js
@@ -0,0 +1,48 @@
+import { TERMINATE_PATTERN } from './constants';
+
+export default class IpLoadBalancerTerminateCtrl {
+ /* @ngInject */
+ constructor(
+ $http,
+ $translate,
+ $uibModalInstance,
+ service,
+ CucControllerHelper,
+ Alerter,
+ ) {
+ this.$uibModalInstance = $uibModalInstance;
+ this.service = service;
+ this.CucControllerHelper = CucControllerHelper;
+ this.TERMINATE_PATTERN = TERMINATE_PATTERN;
+ this.$translate = $translate;
+ this.$http = $http;
+ this.Alerter = Alerter;
+ }
+
+ dismiss() {
+ this.$uibModalInstance.dismiss();
+ }
+
+ terminate() {
+ this.$http
+ .post(`/ipLoadbalancing/${this.service.serviceName}/terminate`)
+ .then(() => {
+ this.Alerter.success(
+ this.$translate.instant('iplb_terminate_service_success'),
+ );
+ })
+ .catch((err) => {
+ this.Alerter.error(
+ this.$translate.instant('iplb_terminate_service_error', {
+ t0: err.data ? err.data.message : err.message,
+ }),
+ this.alertId,
+ );
+ });
+ this.$uibModalInstance.close();
+ }
+
+ close() {
+ this.$uibModalInstance.close();
+ }
+}
diff --git a/packages/manager/modules/iplb/src/modal/terminate/terminate.html b/packages/manager/modules/iplb/src/modal/terminate/terminate.html
new file mode 100644
index 000000000000..9ffcc259bd6b
--- /dev/null
+++ b/packages/manager/modules/iplb/src/modal/terminate/terminate.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+