<commit_before>import { Component, OnInit } from '@angular/core';
import { NgbTabChangeEvent } from '@ng-bootstrap/ng-bootstrap';
import { JhiHistoryService } from './history.service';

@Component({
    selector: 'jhi-history',
    templateUrl: './history.component.html',
})
export class JhiHistoryComponent implements OnInit {
    items: any;
    data: any;

    constructor(private historyService: JhiHistoryService) {
    }

    ngOnInit() {
        this.refresh();
    }

    refresh() {
        this.historyService.findAll().toPromise().then((data) => {
            this.data = data;
            this.activate('registered');
        });

    }

    activate(key: string) {
        this.items = [];
        let obj = this.data ? this.data[key] : null;
        if (obj) {
            for (let k of obj) {
                this.items.push({key: k, value: obj[k]});
            }
        }
    }

    beforeChange($event: NgbTabChangeEvent) {
        this.activate($event.nextId);
    };
}<commit_msg>fix HistoryComponent loop<commit_after>import { Component, OnInit } from '@angular/core';
import { NgbTabChangeEvent } from '@ng-bootstrap/ng-bootstrap';
import { JhiHistoryService } from './history.service';

@Component({
    selector: 'jhi-history',
    templateUrl: './history.component.html',
})
export class JhiHistoryComponent implements OnInit {
    items: any;
    data: any;

    constructor(private historyService: JhiHistoryService) {}

    ngOnInit() {
        this.refresh();
    }

    refresh() {
        this.historyService.findAll().toPromise().then((data) => {
            this.data = data;
            this.activate('registered');
        });
    }

    activate(key: string) {
        this.items = [];
        let obj = this.data ? this.data[key] : null;
        if (obj) {
            for (let k of Object.keys(obj)) {
                this.items.push({key: k, value: obj[k]});
            }
        }
    }

    beforeChange($event: NgbTabChangeEvent) {
        this.activate($event.nextId);
    };
}
{'fraction_non_alphanumeric': 0.1458230350963915, 'fraction_numerical': 0.0, 'mean_word_length': 2.30718954248366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3011206', 'n_tokens_mistral': 608, 'n_tokens_neox': 591, 'n_words': 120}