<commit_before>//Angular2 Imports
import {Component} from 'angular2/core';
import {NgClass} from 'angular2/common';
import {RouteParams, RouterLink, Router} from 'angular2/router';

//File Interface & Component
import {File, FileComponent} from '../file/file';
import {Spinner} from '../spinner/spinner';
import {ApiService} from '../../services/api/api';

@Component({
  selector: 'file-list',
  template: require('./fileList.html'),
  styles: [require('./fileList.scss')],
  directives: [FileComponent, NgClass, RouterLink, Spinner]
})

export class FileListComponent {
  public files: Array<File>;
  public loading: boolean;
  public filter: string;

  constructor(
    private _api: ApiService,
    private params: RouteParams,
    private _router: Router
  ) {}

  ngOnInit() {
    this.loadFiles();
  }

  loadFiles() {
    var fileList = this;
    fileList.loading = true;
    fileList.filter = fileList.params.get('type');
    var list = fileList._api.files(fileList.filter);
    list
      .map(res => res.json())
      .subscribe(
        data => {
          for (var file in data) {
            //Parse the date from UTC Seconds string to Date Object
            data[file].modified_date = Date.parse(data[file].modified_date);

            //Set the properties for front-end controls.
            data[file].active = false;  //Selects the file
            data[file].editing = false; //Opens editing view of the file
          }
          fileList.files = data;
        },
        err => {
          console.error(err);
        },
        () => {
          console.log('API Call Complete: Files');
          fileList.loading = false;
        }
      );
  }

  selectFile(file: File) {
    var fileList = this;
    if (!file.active) {
      fileList.files.forEach((file) => {
        //Reset the state of each file component
        file.editing = false;
        file.active = false;
      });
      file.active = true;
    }
  }
}<commit_msg>chore(FileList): var->let; switch to 'this' notation<commit_after>//Angular2 Imports
import {Component} from 'angular2/core';
import {NgClass} from 'angular2/common';
import {RouteParams, RouterLink, Router} from 'angular2/router';

//File Interface & Component
import {File, FileComponent} from '../file/file';
import {Spinner} from '../spinner/spinner';
import {ApiService} from '../../services/api/api';

@Component({
  selector: 'file-list',
  template: require('./fileList.html'),
  styles: [require('./fileList.scss')],
  directives: [FileComponent, NgClass, RouterLink, Spinner]
})

export class FileListComponent {
  public files: Array<File>;
  public loading: boolean;
  public filter: string;

  constructor(
    private _api: ApiService,
    private params: RouteParams,
    private _router: Router
  ) {}

  ngOnInit() {
    this.loadFiles();
  }

  loadFiles() {
    this.loading = true;
    this.filter = this.params.get('type');
    let list = this._api.files(this.filter);
    list
      .map(res => res.json())
      .subscribe(
        data => {
          for (let file in data) {
            //Parse the date from UTC Seconds string to Date Object
            data[file].modified_date = Date.parse(data[file].modified_date);

            //Set the properties for front-end controls.
            data[file].active = false;  //Selects the file
            data[file].editing = false; //Opens editing view of the file
          }
          this.files = data;
        },
        err => {
          console.error(err);
        },
        () => {
          console.log('API Call Complete: Files');
          this.loading = false;
        }
      );
  }

  selectFile(file: File) {
    if (!file.active) {
      this.files.forEach((file) => {
        //Reset the state of each file component
        file.editing = false;
        file.active = false;
      });
      file.active = true;
    }
  }
}
{'fraction_non_alphanumeric': 0.1371280724450194, 'fraction_numerical': 0.002069857697283312, 'mean_word_length': 2.376419213973799, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '7645846', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1144, 'n_words': 301}