<commit_before>import { Component, OnInit } from '@angular/core';
import { CookieService } from 'ng2-cookies';
import { Router, NavigationStart, NavigationEnd } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import * as myGlobals from './globals';

@Component({
	selector: 'nimble-app',
	providers: [ CookieService ],
	templateUrl: './app.component.html',
	styleUrls: ['./app.component.css']
})

export class AppComponent implements OnInit {

	public loading = false;
	public isLoggedIn = false;
	public isCollapsed = true;
	public alertBetaClosed = false;
	public fullName = "";
	public activeCompanyName = null;
	public eMail = "";
	public userID = "";
	public roles = [];
	public debug = myGlobals.debug;
	public mailto = "";
	
	constructor(
		private cookieService: CookieService,
		private router: Router,
		private modalService: NgbModal
	) {	
		router.events.subscribe(event => {
			if(event instanceof NavigationStart) {
				this.loading = true;
			}
		});
		router.events.subscribe(event => {
			if(event instanceof NavigationEnd) {
				this.loading = false;
			}
		});
	}
	
	ngOnInit() {
		this.checkLogin("");
	}
	
	public open(content) {
		this.mailto = "mailto:<EMAIL>";
		var subject = "NIMBLE Support Request";
		this.mailto += "?subject="+encodeURIComponent(subject);
		var body = "Dear NIMBLE support team,";
		body += "\n\n\n";
		body += "I have encountered an issue.";
		body += "\n\n";
		body += "Timestamp:\n"+new Date().toISOString();
		body += "\n\n";
		body += "Path:\n"+window.location.href;
		body += "\n\n";
		body += "Description of the issue:\n";
		body += "[Please insert a detailed description of the issue here. Add some screenshots as an attachement if they are of use.]";
		body += "\n\n";
		body += "Cause of the issue:\n";
		body += "[Please describe the actions taken that caused the issue here.]";
		body += "\n\n\n";
		body += "Best regards,";
		body += "\n\n";
		body += this.fullName;
		body += "\n";
		body += "(E-Mail: "+this.eMail+", UserID: "+this.userID+", Company: "+this.activeCompanyName+")";
		this.mailto += "&body="+encodeURIComponent(body);
		this.modalService.open(content);
	}
	
	public checkLogin(path:any) {
		if (this.cookieService.get("user_id")) {
			this.isLoggedIn = true;
			this.fullName = this.cookieService.get("user_fullname");
			this.eMail = this.cookieService.get("user_email");
			this.userID = this.cookieService.get("user_id");
			if (this.cookieService.get('bearer_token')) {
				const at = this.cookieService.get('bearer_token');
				if (at.split(".").length == 3) {
					const at_payload = at.split(".")[1];
					try {
						const at_payload_json = JSON.parse(atob(at_payload));
						const at_payload_json_roles = at_payload_json["realm_access"]["roles"];
						this.roles = at_payload_json_roles;<commit_msg>Moved userID and timestamp to subject line in support requests in order to make them unique<commit_after>import { Component, OnInit } from '@angular/core';
import { CookieService } from 'ng2-cookies';
import { Router, NavigationStart, NavigationEnd } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import * as myGlobals from './globals';

@Component({
	selector: 'nimble-app',
	providers: [ CookieService ],
	templateUrl: './app.component.html',
	styleUrls: ['./app.component.css']
})

export class AppComponent implements OnInit {

	public loading = false;
	public isLoggedIn = false;
	public isCollapsed = true;
	public alertBetaClosed = false;
	public fullName = "";
	public activeCompanyName = null;
	public eMail = "";
	public userID = "";
	public roles = [];
	public debug = myGlobals.debug;
	public mailto = "";
	
	constructor(
		private cookieService: CookieService,
		private router: Router,
		private modalService: NgbModal
	) {	
		router.events.subscribe(event => {
			if(event instanceof NavigationStart) {
				this.loading = true;
			}
		});
		router.events.subscribe(event => {
			if(event instanceof NavigationEnd) {
				this.loading = false;
			}
		});
	}
	
	ngOnInit() {
		this.checkLogin("");
	}
	
	public open(content) {
		this.mailto = "mailto:<EMAIL>";
		var subject = "NIMBLE Support Request (UserID: "+this.userID+", Timestamp: "+new Date().toISOString()+")";
		this.mailto += "?subject="+encodeURIComponent(subject);
		var body = "Dear NIMBLE support team,";
		body += "\n\n\n";
		body += "I have encountered an issue.";
		body += "\n\n";
		body += "Path:\n"+window.location.href;
		body += "\n\n";
		body += "Description of the issue:\n";
		body += "[Please insert a detailed description of the issue here. Add some screenshots as an attachement if they are of use.]";
		body += "\n\n";
		body += "Cause of the issue:\n";
		body += "[Please describe the actions taken that caused the issue here.]";
		body += "\n\n\n";
		body += "Best regards,";
		body += "\n\n";
		body += this.fullName;
		body += "\n";
		body += "(E-Mail: "+this.eMail+", Company: "+this.activeCompanyName+")";
		this.mailto += "&body="+encodeURIComponent(body);
		this.modalService.open(content);
	}
	
	public checkLogin(path:any) {
		if (this.cookieService.get("user_id")) {
			this.isLoggedIn = true;
			this.fullName = this.cookieService.get("user_fullname");
			this.eMail = this.cookieService.get("user_email");
			this.userID = this.cookieService.get("user_id");
			if (this.cookieService.get('bearer_token')) {
				const at = this.cookieService.get('bearer_token');
				if (at.split(".").length == 3) {
					const at_payload = at.split(".")[1];
					try {
						const at_payload_json = JSON.parse(atob(at_payload));
						const at_payload_json_roles = at_payload_json["realm_access"]["roles"];
						this.roles = at_payload_json_roles;
{'fraction_non_alphanumeric': 0.16142078424476877, 'fraction_numerical': 0.0010550378055213644, 'mean_word_length': 4.002638522427441, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3794857', 'n_tokens_mistral': 2071, 'n_tokens_neox': 1873, 'n_words': 458}