<commit_before>﻿import { Component, Input, Output, EventEmitter, ViewChild, OnInit } from '@angular/core';
import { IChildElement } from '../../interfaces/htmlInterfaces';

@Component({
    selector: 'json-file-uploader',
    template: `
    <div>
        <form #form>
            <div class="input-group">
                <span class="input-group-btn">
                    <div class="fileUpload btn btn-primary">
                        <span class="glyphicon-btn glyphicon glyphicon-folder-open"></span>
                        <input type="file" #input name="upload" accept="image/*" class="upload" (change)="fileChanged()">           
                    </div> 
                </span>
                <span class="input-group-addon upload-text" (click)="onFileNameClicked()">
                    {{fileName}}                 
                </span>  
                <span class="input-group-btn">             
                    <button type="button" class="btn btn-primary" (click)="upload()"><span class="glyphicon-btn glyphicon glyphicon-cloud-upload"></span></button>
                </span>  
            </div>
        </form>
        <p>{{message}}</p>
    </div>
`
})
export class JsonFileUploaderComponent implements OnInit{
    @Input('csMessage')
    message: string;
    @Output('csMessage')
    messageChange: EventEmitter<string> = new EventEmitter<string>();
    @Output()
    onUpload: EventEmitter<any> = new EventEmitter<any>();
    @ViewChild('input')
    input: IChildElement<HTMLInputElement>;
    @ViewChild('form')
    form: IChildElement<HTMLFormElement>;

    fileName : string;

    ngOnInit() {
        this.setFileNameToDefault()
    }<commit_msg>Fixed Json File Upload bug (#121)<commit_after>﻿import { Component, Input, Output, EventEmitter, ViewChild, OnInit } from '@angular/core';
import { IChildElement } from '../../interfaces/htmlInterfaces';

@Component({
    selector: 'json-file-uploader',
    template: `
    <div>
        <form #form>
            <div class="input-group">
                <span class="input-group-btn">
                    <div class="fileUpload btn btn-primary">
                        <span class="glyphicon-btn glyphicon glyphicon-folder-open"></span>
                        <input type="file" #input name="upload" accept=".json" class="upload" (change)="fileChanged()">           
                    </div> 
                </span>
                <span class="input-group-addon upload-text" (click)="onFileNameClicked()">
                    {{fileName}}                 
                </span>  
                <span class="input-group-btn">             
                    <button type="button" class="btn btn-primary" (click)="upload()"><span class="glyphicon-btn glyphicon glyphicon-cloud-upload"></span></button>
                </span>  
            </div>
        </form>
        <p>{{message}}</p>
    </div>
`
})
export class JsonFileUploaderComponent implements OnInit{
    @Input('csMessage')
    message: string;
    @Output('csMessage')
    messageChange: EventEmitter<string> = new EventEmitter<string>();
    @Output()
    onUpload: EventEmitter<any> = new EventEmitter<any>();
    @ViewChild('input')
    input: IChildElement<HTMLInputElement>;
    @ViewChild('form')
    form: IChildElement<HTMLFormElement>;

    fileName : string;

    ngOnInit() {
        this.setFileNameToDefault()
    }
{'fraction_non_alphanumeric': 0.14698937426210154, 'fraction_numerical': 0.0008854781582054309, 'mean_word_length': 2.137962962962963, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 61, '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': '7660048', 'n_tokens_mistral': 950, 'n_tokens_neox': 907, 'n_words': 185}