<commit_before>import { IEcsLoadBalancerSourceData, IEcsLoadBalancer, IEcsTargetGroup } from '../domain/IEcsLoadBalancer';

export class EcsLoadBalancerTransformer {
  public normalizeLoadBalancer(loadBalancer: IEcsLoadBalancerSourceData): IEcsLoadBalancer {
    loadBalancer.targetGroups.forEach((tg: IEcsTargetGroup) => {
      tg.region = loadBalancer.region;
      tg.account = loadBalancer.account;
      tg.cloudProvider = loadBalancer.cloudProvider;
      if (loadBalancer.targetGroupServices) {
        const tgServiceMap = loadBalancer.targetGroupServices;
        tg.serverGroups = tgServiceMap[tg.targetGroupArn];
      }
    });
    return loadBalancer;
  }
}<commit_msg>fix(ecs): return promise from normalizeLoadBalancer (#8323)<commit_after>import { IQService, IPromise } from 'angular';
import { IEcsLoadBalancerSourceData, IEcsLoadBalancer, IEcsTargetGroup } from '../domain/IEcsLoadBalancer';

export class EcsLoadBalancerTransformer {
  public static $inject = ['$q'];
  constructor(private $q: IQService) {}

  public normalizeLoadBalancer(loadBalancer: IEcsLoadBalancerSourceData): IPromise<IEcsLoadBalancer> {
    loadBalancer.targetGroups.forEach((tg: IEcsTargetGroup) => {
      tg.region = loadBalancer.region;
      tg.account = loadBalancer.account;
      tg.cloudProvider = loadBalancer.cloudProvider;
      if (loadBalancer.targetGroupServices) {
        const tgServiceMap = loadBalancer.targetGroupServices;
        tg.serverGroups = tgServiceMap[tg.targetGroupArn];
      }
    });
    return this.$q.resolve(loadBalancer);
  }
}
{'fraction_non_alphanumeric': 0.09929532351057015, 'fraction_numerical': 0.0025624599615631004, 'mean_word_length': 4.6389891696750905, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4264741', 'n_tokens_mistral': 481, 'n_tokens_neox': 461, 'n_words': 77}