From 01692385e0d7ff0cd4c89c6d4bb3ab31bb6a61ff Mon Sep 17 00:00:00 2001 From: Hyenne Guillaume Date: Mon, 28 Aug 2023 16:27:05 +0200 Subject: [PATCH] fix(telecom.sms): fix issue with index if data grid is sorted (#9879) ref: DTRSD-117586 Signed-off-by: Guillaume Hyenne --- .../edit/telecom-sms-options-response-edit.controller.js | 5 ++++- .../telecom-sms-options-response-remove.controller.js | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/manager/modules/sms/src/sms/options/response/edit/telecom-sms-options-response-edit.controller.js b/packages/manager/modules/sms/src/sms/options/response/edit/telecom-sms-options-response-edit.controller.js index f7509c3623d0..bb6b5eddb261 100644 --- a/packages/manager/modules/sms/src/sms/options/response/edit/telecom-sms-options-response-edit.controller.js +++ b/packages/manager/modules/sms/src/sms/options/response/edit/telecom-sms-options-response-edit.controller.js @@ -1,4 +1,5 @@ import angular from 'angular'; +import isEqual from 'lodash/isEqual'; import get from 'lodash/get'; import pull from 'lodash/pull'; @@ -41,7 +42,9 @@ export default class { this.model = { service: angular.copy(this.service), senders: angular.copy(this.senders), - index: this.index, + index: this.service.smsResponse.trackingOptions.findIndex((value) => + isEqual(value, this.option), + ), option: angular.copy(this.option), }; this.availableTrackingMedia = []; diff --git a/packages/manager/modules/sms/src/sms/options/response/remove/telecom-sms-options-response-remove.controller.js b/packages/manager/modules/sms/src/sms/options/response/remove/telecom-sms-options-response-remove.controller.js index 370312b589d8..d4fa5508b6e1 100644 --- a/packages/manager/modules/sms/src/sms/options/response/remove/telecom-sms-options-response-remove.controller.js +++ b/packages/manager/modules/sms/src/sms/options/response/remove/telecom-sms-options-response-remove.controller.js @@ -1,5 +1,6 @@ import angular from 'angular'; import remove from 'lodash/remove'; +import isEqual from 'lodash/isEqual'; export default class { /* @ngInject */ @@ -45,9 +46,8 @@ export default class { */ remove() { this.loading.removeTrackingOption = true; - remove( - this.model.service.smsResponse.trackingOptions, - this.model.service.smsResponse.trackingOptions[this.model.index], + remove(this.model.service.smsResponse.trackingOptions, (value) => + isEqual(value, this.model.option), ); return this.$q .all([