Sha256: 8eae78b8b8deab52f6dbd2b831fdbd7f2f7e69060aac0de4d134930113c15889

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

import React from 'react';

import PropTypes from 'prop-types';

export class JobStatus extends React.Component {
    static registerForPubSub = true;
    static listenNetworkEvents = true;

    static propTypes = {
        job: Hippo.PropTypes.State,
        onlyExecuting: PropTypes.bool,
        message: PropTypes.string
    };

    static modelBindings = { job: 'props' };    statusMessage() {
        if (_.isEmpty(this.job.stepsCompleted)) { return ''; } else {
            return (
                `Completed: ${_.toSentence(this.job.stepsCompleted)}`
            );
        }
    }

    progressBar() {
        if (!this.job.progress) { return null; }
        return (
            <BS.ProgressBar now={this.job.progress * 100} />
        );
    }

    render() {
        if (this.props.onlyExecuting && !this.job.isExecuting) { return null; }
        return (
            <div export className="job-executing">
                <h3 export className="message">
                    {this.props.message}
                </h3>
                <LC.Throbber />
                <div export className="status">
                    {this.statusMessage()}
                </div>
                {this.progressBar()}
                {this.props.children}
            </div>
        );
    }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hippo-fw-0.9.5 client/hippo/components/shared/JobProgress.jsx
hippo-fw-0.9.4 client/hippo/components/shared/JobProgress.jsx
hippo-fw-0.9.3 client/hippo/components/shared/JobProgress.jsx
hippo-fw-0.9.2 client/hippo/components/shared/JobProgress.jsx
hippo-fw-0.9.1 client/hippo/components/shared/JobProgress.jsx