<commit_before>import { Component, OnInit, Input } from '@angular/core';

import { ProjectUser } from './../model';
import { ProjectUsersService } from './../services/project-users.service';

@Component({
    selector: 'add-project-user',
    templateUrl: 'add-project-user.component.html',
    styleUrls: ['add-project-user.component.css']
})
export class AddProjectUserComponent implements OnInit {
    @Input()
    private projectId: string;

    get roles(): string[] {
        return ['owner', 'editor', 'viewer'];
    }

    private email: string;
    private selectedRole: string = '';
    private modalOpen: boolean;
    private errors: string[];
    private loading: boolean;

    constructor(private service: ProjectUsersService) { }

    ngOnInit() { }

    openModal() {
        this.modalOpen = true;
    }

    closeModal() {
        this.modalOpen = false;
        this.reset();
    }

    reset() {
        this.email = '';
    }

    valid(): boolean {
        return false;
    }

    submit() {
        this.loading = true;
        let user: ProjectUser = { email: this.email, project_id: this.projectId, role: this.selectedRole }
        this.service.createProjectUser(user)
            .subscribe(
            res => console.log(res),
            err => this.errors = err,
            () => this.loading = false,
        )
    }
}<commit_msg>Add selected role to reset method<commit_after>import { Component, OnInit, Input } from '@angular/core';

import { ProjectUser } from './../model';
import { ProjectUsersService } from './../services/project-users.service';

@Component({
    selector: 'add-project-user',
    templateUrl: 'add-project-user.component.html',
    styleUrls: ['add-project-user.component.css']
})
export class AddProjectUserComponent implements OnInit {
    @Input()
    private projectId: string;

    get roles(): string[] {
        return ['owner', 'editor', 'viewer'];
    }

    private email: string = '';
    private selectedRole: string = '';
    private modalOpen: boolean = false;
    private loading: boolean = false;
    private errors: string[];

    constructor(private service: ProjectUsersService) { }

    ngOnInit() { }

    openModal() {
        this.modalOpen = true;
    }

    closeModal() {
        this.modalOpen = false;
        this.reset();
    }

    reset() {
        this.email = '';
        this.selectedRole = '';
    }

    valid(): boolean {
        return false;
    }

    submit() {
        this.loading = true;
        let user: ProjectUser = { email: this.email, project_id: this.projectId, role: this.selectedRole }
        this.service.createProjectUser(user)
            .subscribe(
            res => console.log(res),
            err => this.errors = err,
            () => this.loading = false,
        )
    }
}
{'fraction_non_alphanumeric': 0.13862093604858877, 'fraction_numerical': 0.0, 'mean_word_length': 2.3653846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5404875', 'n_tokens_mistral': 799, 'n_tokens_neox': 781, 'n_words': 188}