<commit_before>﻿import { Component, Input, Output, EventEmitter, ContentChild, TemplateRef, AfterViewInit } from '@angular/core';
import { FormGroup, FormControl, Validators, FormBuilder } from '@angular/forms';
import { ColumnModel } from './column';

@Component({
    selector: 'filter-dialog',
    template: `
   <form [formGroup]="form" (ngSubmit)="onSubmit()">
        <div class="form-group">
            <label>Text</label>
            <input type="text" class="form-control" formControlName="text" />
            <label *ngIf="isBetween">Text 2</label>
            <input *ngIf="isBetween" type="text" class="form-control" formControlName="text2" />
        </div>
        <div class="form-group">
            <label for="operator">Operator</label>
            <select id="operator" class="form-control" formControlName="operator">
                <option *ngFor="let operator of operators" [value]="operator.value">{{operator.name}}</option>
            </select>
        </div>
        <div class="row">
            <div class="col-xs-6">
                <button type="submit" class="btn btn-sm btn-success btn-block" 
                        [disabled]="!form.valid">Filter</button>
            </div>
            <div class="col-xs-6">
                <button class="btn btn-sm btn-danger btn-block" 
                        (click)="reset()">Clear</button>
            </div>
        </div>
    </form>`
})
export class ColumnFilterDialog implements AfterViewInit {
    @Input() column: ColumnModel;
    @Output() onFilteringChange = new EventEmitter<boolean>();
    form: FormGroup;
    operators: Object[];
    public isBetween: boolean;

    constructor(fb: FormBuilder) {
        this.form = fb.group({
            "text": ["", Validators.required],
            "text2": [""],
            "operator": ["None",Validators.required]
        });

        this.isBetween = false;

        this.form.valueChanges.subscribe((value) => {
            this.column.filter.text = value.text;
            this.column.filter.text2 = value.text2;
            this.column.filter.operator = value.operator;
            if (value.operator == "Between") {
                this.isBetween = true;
            }
            else {
                this.isBetween = false;
            }
        });
    }

    ngAfterViewInit() {
        // set initial value in form with a timeout
        setTimeout(_ => {<commit_msg>change condition format<commit_after>﻿import { Component, Input, Output, EventEmitter, ContentChild, TemplateRef, AfterViewInit } from '@angular/core';
import { FormGroup, FormControl, Validators, FormBuilder } from '@angular/forms';
import { ColumnModel } from './column';

@Component({
    selector: 'filter-dialog',
    template: `
   <form [formGroup]="form" (ngSubmit)="onSubmit()">
        <div class="form-group">
            <label>Text</label>
            <input type="text" class="form-control" formControlName="text" />
            <label *ngIf="isBetween">Text 2</label>
            <input *ngIf="isBetween" type="text" class="form-control" formControlName="text2" />
        </div>
        <div class="form-group">
            <label for="operator">Operator</label>
            <select id="operator" class="form-control" formControlName="operator">
                <option *ngFor="let operator of operators" [value]="operator.value">{{operator.name}}</option>
            </select>
        </div>
        <div class="row">
            <div class="col-xs-6">
                <button type="submit" class="btn btn-sm btn-success btn-block" 
                        [disabled]="!form.valid">Filter</button>
            </div>
            <div class="col-xs-6">
                <button class="btn btn-sm btn-danger btn-block" 
                        (click)="reset()">Clear</button>
            </div>
        </div>
    </form>`
})
export class ColumnFilterDialog implements AfterViewInit {
    @Input() column: ColumnModel;
    @Output() onFilteringChange = new EventEmitter<boolean>();
    form: FormGroup;
    operators: Object[];
    public isBetween: boolean;

    constructor(fb: FormBuilder) {
        this.form = fb.group({
            "text": ["", Validators.required],
            "text2": [""],
            "operator": ["None",Validators.required]
        });

        this.isBetween = false;

        this.form.valueChanges.subscribe((value) => {
            this.column.filter.text = value.text;
            this.column.filter.text2 = value.text2;
            this.column.filter.operator = value.operator;
            this.isBetween = value.operator == "Between";
        });
    }

    ngAfterViewInit() {
        // set initial value in form with a timeout
        setTimeout(_ => {
{'fraction_non_alphanumeric': 0.14981987709260436, 'fraction_numerical': 0.0029667302394575123, 'mean_word_length': 2.2065217391304346, 'pattern_counts': {'":': 6, '<': 61, '<?xml version=': 0, '>': 65, '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': '2564177', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1282, 'n_words': 273}