<commit_before>import { Injectable } from '@angular/core';
import {Subject, Observable} from "rxjs";
import {Response} from "@angular/http";
import {MoonConnectServiceService} from "./moon-connect-service.service";

@Injectable()
export class MoonConfigurationService {
    /**
     * Stores the Configuration Information for all scripts
     */
    private configuration: any;
    private script:number=0;
    private scriptChange:Subject<number>=new Subject<number>();
    private interfaceNodes:any=[];
    private interfacesChange:Subject<any>=new Subject<any>();
    private input:any[]=[];
    private inputChange:Subject<any>=new Subject<any>();
    private title:string="";
    private titleChange:Subject<string>=new Subject<string>();
    private wait:Subject<boolean>=new Subject<boolean>();

  constructor(public connectService:MoonConnectServiceService) {
      this.getConfiguration();
  }
  public getConfiguration(){
      this.connectService.get("/config/").map((result)=>result.json()).subscribe((result)=>this.writeConfiguration(result),(error)=>this.getConfiguration());
    }
  public writeConfiguration(config:any){
      this.configuration=config;
      this.setTitle(this.configuration[this.script].name);
      this.wait.next(true);
  }

  public getWait():Subject<boolean>{
      return this.wait;
  }

  public getConfiguration(id:number):any{
      return this.configuration[id];
  }
  public getConfigurationList():any{
      return this.configuration;
  }<commit_msg>Added Configuration to server<commit_after>import { Injectable } from '@angular/core';
import {Subject, Observable} from "rxjs";
import {Response} from "@angular/http";
import {MoonConnectServiceService} from "./moon-connect-service.service";

@Injectable()
export class MoonConfigurationService {
    /**
     * Stores the Configuration Information for all scripts
     */
    private configuration: any;
    private script:number=0;
    private scriptChange:Subject<number>=new Subject<number>();
    private interfaceNodes:any=[];
    private interfacesChange:Subject<any>=new Subject<any>();
    private input:any[]=[];
    private inputChange:Subject<any>=new Subject<any>();
    private title:string="";
    private titleChange:Subject<string>=new Subject<string>();
    private wait:Subject<boolean>=new Subject<boolean>();

  constructor(public connectService:MoonConnectServiceService) {
      this.configurationHttp();
  }
  public configurationHttp(){
      this.connectService.get("/config/").map((result)=>result.json()).subscribe((result)=>this.writeConfiguration(result),(error)=>this.configurationHttp());
    }
  public writeConfiguration(config:any){
      this.configuration=config;
      this.setTitle(this.configuration[this.script].name);
      this.wait.next(true);
  }

  public getWait():Subject<boolean>{
      return this.wait;
  }

  public getConfiguration(id:number):any{
      return this.configuration[id];
  }
  public getConfigurationList():any{
      return this.configuration;
  }
{'fraction_non_alphanumeric': 0.1380683703949552, 'fraction_numerical': 0.0006637902422834385, 'mean_word_length': 4.98015873015873, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 31, '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': '976504', 'n_tokens_mistral': 804, 'n_tokens_neox': 792, 'n_words': 157}