<commit_before>import {Component, CORE_DIRECTIVES} from 'angular2/angular2';
import {SimpleList} from 'InfomediaLtd/angular2-simple-list/app/components/simple-list.ts!';
import {UserView} from "../views/user-view";
import {User} from "../data/user";

import {AppStore} from "angular2-redux";
import {UserActions} from "../actions/user-actions";

@Component({
    selector: 'users-with-details',
    template: `
        <simple-list
            [list]="users"
            [content]="getContent"
            [link]="getLink"
            (current)="selectCurrentUser($event)">
        </simple-list>
        <user *ng-if="currentUser" [user]="currentUser" class="border:1px solid black"></user>
    `,
    directives: [CORE_DIRECTIVES, SimpleList, UserView]
})
export class UsersListWithDetails {

    private users:User[];
    private currentUser:User;

    private selectCurrentUser;

    constructor(private appStore:AppStore,
                private userActions:UserActions) {

        this.selectCurrentUser = userActions.createDispatcher(appStore, userActions.setCurrentUser);

        appStore.subscribe((state) => {
            this.users = state.users;
            this.currentUser = state.current;
        });

        appStore.dispatch(userActions.fetchUsers());
    }

    getContent(user:User):string { return user.name; }<commit_msg>Use Actions base class to dispatch actions<commit_after>import {Component, CORE_DIRECTIVES} from 'angular2/angular2';
import {SimpleList} from 'InfomediaLtd/angular2-simple-list/app/components/simple-list.ts!';
import {UserView} from "../views/user-view";
import {User} from "../data/user";

import {AppStore} from "angular2-redux";
import {UserActions} from "../actions/user-actions";

@Component({
    selector: 'users-with-details',
    template: `
        <simple-list
            [list]="users"
            [content]="getContent"
            [link]="getLink"
            (current)="selectCurrentUser($event)">
        </simple-list>
        <user *ng-if="currentUser" [user]="currentUser" class="border:1px solid black"></user>
    `,
    directives: [CORE_DIRECTIVES, SimpleList, UserView]
})
export class UsersListWithDetails {

    private users:User[];
    private currentUser:User;

    private selectCurrentUser;

    constructor(appStore:AppStore, userActions:UserActions) {

        this.selectCurrentUser = userActions.createDispatcher(appStore, userActions.setCurrentUser);

        appStore.subscribe((state) => {
            this.users = state.users;
            this.currentUser = state.current;
        });

        appStore.dispatch(userActions.fetchUsers());
    }

    getContent(user:User):string { return user.name; }
{'fraction_non_alphanumeric': 0.13705772811918063, 'fraction_numerical': 0.0037243947858473, 'mean_word_length': 3.2976, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '819060', 'n_tokens_mistral': 787, 'n_tokens_neox': 766, 'n_words': 144}