<commit_before>﻿import * as React from 'react'
import { RouteComponentProps } from 'react-router-dom'
import * as numbro from 'numbro'
import * as Navigator from '../../../Framework/Signum.React/Scripts/Navigator'
import * as Finder from '../../../Framework/Signum.React/Scripts/Finder'
import EntityLink from '../../../Framework/Signum.React/Scripts/SearchControl/EntityLink'
import {ValueSearchControl, SearchControl } from '../../../Framework/Signum.React/Scripts/Search'
import { QueryDescription, SubTokensOptions } from '../../../Framework/Signum.React/Scripts/FindOptions'
import { getQueryNiceName, PropertyRoute, getTypeInfos } from '../../../Framework/Signum.React/Scripts/Reflection'
import { ModifiableEntity, EntityControlMessage, Entity, parseLite, getToString, JavascriptMessage } from '../../../Framework/Signum.React/Scripts/Signum.Entities'
import { API, ProcessLogicState } from './ProcessClient'
import { ProcessEntity } from './Signum.Entities.Processes'



interface ProcessPanelProps extends RouteComponentProps<{}> {

}

export default class ProcessPanelPage extends React.Component<ProcessPanelProps, ProcessLogicState> {

    componentWillMount() {
        this.loadState().done();

        Navigator.setTitle("ProcessLogic state");
    }

    componentWillUnmount() {
        Navigator.setTitle();
    }

    loadState() {
        return API.view()
            .then(s => this.setState(s));
    }

    handleStop = (e: React.MouseEvent<any>) => {
        e.preventDefault();
        API.stop().then(() => this.loadState()).done();
    }

    handleStart = (e: React.MouseEvent<any>) => {
        e.preventDefault();
        API.start().then(() => this.loadState()).done();
    }


    render() {

        if (this.state == undefined)
            return <h2>ProcesLogic state (loading...) </h2>;

        const s = this.state;

        return (
            <div>
                <h2>ProcessLogic state</h2>
                <div className="btn-toolbar">
                    {s.Running && <a href="#" className="sf-button btn btn-light active" style={{ color: "red" }} onClick={this.handleStop}>Stop</a> }
                    {!s.Running && <a href="#" className="sf-button btn btn-light" style={{ color: "green" }} onClick={this.handleStart}>Start</a> }
                </div >
                <div id="processMainDiv">
                    <br />
                    State: <strong>
                        {s.Running ?
                            <span style={{ color: "Green" }}> RUNNING </span> :
                            <span style={{ color: "Red" }}> STOPPED </span>
                        }</strong>
                    <br />
                    JustMyProcesses: {s.JustMyProcesses.toString()}
                    <br />
                    MaxDegreeOfParallelism: { s.MaxDegreeOfParallelism}
                    <br />
                    InitialDelayMiliseconds: { s.InitialDelayMiliseconds }
                    <br />
                    NextPlannedExecution: { s.NextPlannedExecution || "-None-" }
                    <br />
                    <table className="table">
                        <thead>
                            <tr>
                                <th>Process
                                </th>
                                <th>State
                                </th>
                                <th>Progress
                                </th>
                                <th>MachineName
                                </th>
                                <th>ApplicationName
                                </th>
                                <th>IsCancellationRequested
                                </th>

                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td colSpan={4}>
                                    <b> { s.Executing.length } processes executing in { s.MachineName }</b>
                                </td>
                            </tr>
                            { s.Executing.map((item, i) =>
                                <tr key={i}>
                                    <td> <EntityLink lite={item.Process} inSearch={true} /> </td>
                                    <td> { item.State } </td>
                                    <td> { numbro(item.Progress).format("0 %") } </td>
                                    <td> { item.MachineName } </td>
                                    <td> { item.ApplicationName } </td>
                                    <td> { item.IsCancellationRequested } </td>
                                </tr>
                            ) }
                        </tbody>
                    </table>

                    <br />
                    <h2>Latest Processes</h2>
                    <SearchControl findOptions={{
                            queryName: ProcessEntity,
                            orderOptions: [{ columnName: "CreationDate", orderType: "Descending" }],
                            pagination: { elementsPerPage: 10, mode: "Firsts" }
                        }}
                    />
                </div>
            </div>
        );
    }
}


<commit_msg>Fixed Process percentage<commit_after>﻿import * as React from 'react'
import { RouteComponentProps } from 'react-router-dom'
import * as numbro from 'numbro'
import * as Navigator from '../../../Framework/Signum.React/Scripts/Navigator'
import * as Finder from '../../../Framework/Signum.React/Scripts/Finder'
import EntityLink from '../../../Framework/Signum.React/Scripts/SearchControl/EntityLink'
import {ValueSearchControl, SearchControl } from '../../../Framework/Signum.React/Scripts/Search'
import { QueryDescription, SubTokensOptions } from '../../../Framework/Signum.React/Scripts/FindOptions'
import { getQueryNiceName, PropertyRoute, getTypeInfos } from '../../../Framework/Signum.React/Scripts/Reflection'
import { ModifiableEntity, EntityControlMessage, Entity, parseLite, getToString, JavascriptMessage } from '../../../Framework/Signum.React/Scripts/Signum.Entities'
import { API, ProcessLogicState } from './ProcessClient'
import { ProcessEntity } from './Signum.Entities.Processes'



interface ProcessPanelProps extends RouteComponentProps<{}> {

}

export default class ProcessPanelPage extends React.Component<ProcessPanelProps, ProcessLogicState> {

    componentWillMount() {
        this.loadState().done();

        Navigator.setTitle("ProcessLogic state");
    }

    componentWillUnmount() {
        Navigator.setTitle();
    }

    loadState() {
        return API.view()
            .then(s => this.setState(s));
    }

    handleStop = (e: React.MouseEvent<any>) => {
        e.preventDefault();
        API.stop().then(() => this.loadState()).done();
    }

    handleStart = (e: React.MouseEvent<any>) => {
        e.preventDefault();
        API.start().then(() => this.loadState()).done();
    }


    render() {

        if (this.state == undefined)
            return <h2>ProcesLogic state (loading...) </h2>;

        const s = this.state;

        return (
            <div>
                <h2>ProcessLogic state</h2>
                <div className="btn-toolbar">
                    {s.Running && <a href="#" className="sf-button btn btn-light active" style={{ color: "red" }} onClick={this.handleStop}>Stop</a> }
                    {!s.Running && <a href="#" className="sf-button btn btn-light" style={{ color: "green" }} onClick={this.handleStart}>Start</a> }
                </div >
                <div id="processMainDiv">
                    <br />
                    State: <strong>
                        {s.Running ?
                            <span style={{ color: "Green" }}> RUNNING </span> :
                            <span style={{ color: "Red" }}> STOPPED </span>
                        }</strong>
                    <br />
                    JustMyProcesses: {s.JustMyProcesses.toString()}
                    <br />
                    MaxDegreeOfParallelism: { s.MaxDegreeOfParallelism}
                    <br />
                    InitialDelayMiliseconds: { s.InitialDelayMiliseconds }
                    <br />
                    NextPlannedExecution: { s.NextPlannedExecution || "-None-" }
                    <br />
                    <table className="table">
                        <thead>
                            <tr>
                                <th>Process
                                </th>
                                <th>State
                                </th>
                                <th>Progress
                                </th>
                                <th>MachineName
                                </th>
                                <th>ApplicationName
                                </th>
                                <th>IsCancellationRequested
                                </th>

                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td colSpan={4}>
                                    <b> { s.Executing.length } processes executing in { s.MachineName }</b>
                                </td>
                            </tr>
                            { s.Executing.map((item, i) =>
                                <tr key={i}>
                                    <td> <EntityLink lite={item.Process} inSearch={true} /> </td>
                                    <td> { item.State } </td>
                                    <td> { numbro(item.Progress).format("0.00 %") } </td>
                                    <td> { item.MachineName } </td>
                                    <td> { item.ApplicationName } </td>
                                    <td> { item.IsCancellationRequested } </td>
                                </tr>
                            ) }
                        </tbody>
                    </table>

                    <br />
                    <h2>Latest Processes</h2>
                    <SearchControl findOptions={{
                            queryName: ProcessEntity,
                            orderOptions: [{ columnName: "CreationDate", orderType: "Descending" }],
                            pagination: { elementsPerPage: 10, mode: "Firsts" }
                        }}
                    />
                </div>
            </div>
        );
    }
}



{'fraction_non_alphanumeric': 0.12745098039215685, 'fraction_numerical': 0.0020940415000951836, 'mean_word_length': 1.1460375816993464, 'pattern_counts': {'":': 0, '<': 153, '<?xml version=': 0, '>': 165, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6435521', 'n_tokens_mistral': 2650, 'n_tokens_neox': 2543, 'n_words': 494}