<commit_before>import { Component, OnDestroy, trigger, state, style } from '@angular/core';
import { Router } from '@angular/router';

import { Subscription } from 'rxjs';

import { TagsService } from './tags.service';
import { Tag } from '../shared/models';


@Component({
    selector: 'tags-list',
    templateUrl: './html/tags-list.html',
    styles: [
        'div#modal { position: fixed; width: 100%; height: 100%; top: 0; left: 0; background-color: rgba(0, 0, 0, 0.48); z-index: 4000; }',
        '.modal { display: block; top: 10%; width: 80%; }',
        '.root { font-weight: bold; }',
        '.modal-content { overflow: hidden; height: 100%; }',
        '.modal-content > div.row { height: 86%; }',
        '.modal-content div.row .col:first-child { height: 100%; }',
        '.modal-content div.row .col:first-child > div:last-child { overflow-y: auto; height: 100%; }',
        '.switch { display: inline; }',
        'span.badge { right: 64px; }',
        'a { cursor: pointer; }',
        '.tag-item { cursor: pointer; }'
    ],
    animations: [
        trigger('panelState', [
            state('show', style({
                display: 'block'
            })),
            state('hide', style({
                display: 'none'
            }))
        ])
    ]
})
export class TagsListComponent implements OnDestroy {
    private _tags: Tag[] = [];
    private subs: Subscription[] = [];
    private order: boolean = true;
    private edit: number = -1;
    private editfield: string = '';
    private deleteCheck: number = -1;
    public tags: Tag[];
    public merge: Tag[];
    public visible: string = 'hide';
    public showall: boolean = false;

    constructor(private service: TagsService, private router: Router) {
        this.merge = [];

        this.subs.push(service.contentTags.subscribe(tags => {
            this.tags = tags;
            this._tags = this.tags.slice(0);
            this.merge = [];
        }));
    }
    ngOnDestroy() {
        this.subs.forEach(sub => sub.unsubscribe());
    }
    close() {
        this.visible = 'hide';
    }
    show() {
        this.service.getTagWithCount();
        this.visible = 'show';
    }
    toggleSelection(tag: Tag) {
        this.deleteCheck = -1;
        let index = this.merge.indexOf(tag);
        if (index != -1) {
            this.merge.splice(index, 1);
        }
        else {
            this.merge.push(tag);<commit_msg>Defaulted to sort by name<commit_after>import { Component, OnDestroy, trigger, state, style } from '@angular/core';
import { Router } from '@angular/router';

import { Subscription } from 'rxjs';

import { TagsService } from './tags.service';
import { Tag } from '../shared/models';


@Component({
    selector: 'tags-list',
    templateUrl: './html/tags-list.html',
    styles: [
        'div#modal { position: fixed; width: 100%; height: 100%; top: 0; left: 0; background-color: rgba(0, 0, 0, 0.48); z-index: 4000; }',
        '.modal { display: block; top: 10%; width: 80%; }',
        '.root { font-weight: bold; }',
        '.modal-content { overflow: hidden; height: 100%; }',
        '.modal-content > div.row { height: 86%; }',
        '.modal-content div.row .col:first-child { height: 100%; }',
        '.modal-content div.row .col:first-child > div:last-child { overflow-y: auto; height: 100%; }',
        '.switch { display: inline; }',
        'span.badge { right: 64px; }',
        'a { cursor: pointer; }',
        '.tag-item { cursor: pointer; }'
    ],
    animations: [
        trigger('panelState', [
            state('show', style({
                display: 'block'
            })),
            state('hide', style({
                display: 'none'
            }))
        ])
    ]
})
export class TagsListComponent implements OnDestroy {
    private _tags: Tag[] = [];
    private subs: Subscription[] = [];
    private order: boolean = true;
    private edit: number = -1;
    private editfield: string = '';
    private deleteCheck: number = -1;
    public tags: Tag[];
    public merge: Tag[];
    public visible: string = 'hide';
    public showall: boolean = false;

    constructor(private service: TagsService, private router: Router) {
        this.merge = [];

        this.subs.push(service.contentTags.subscribe(tags => {
            this.tags = tags;
            this._tags = this.tags.slice(0);
            this.merge = [];
            this.sortBy('name');
        }));
    }
    ngOnDestroy() {
        this.subs.forEach(sub => sub.unsubscribe());
    }
    close() {
        this.visible = 'hide';
    }
    show() {
        this.service.getTagWithCount();
        this.visible = 'show';
    }
    toggleSelection(tag: Tag) {
        this.deleteCheck = -1;
        let index = this.merge.indexOf(tag);
        if (index != -1) {
            this.merge.splice(index, 1);
        }
        else {
            this.merge.push(tag);
{'fraction_non_alphanumeric': 0.16499488229273285, 'fraction_numerical': 0.016786079836233366, 'mean_word_length': 2.1101209420751115, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '4879267', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1462, 'n_words': 362}