Sha256: a3753854807eea9579217db1b59782d319812df36c775352b9047c3084a5d848

Contents?: true

Size: 1.59 KB

Versions: 20

Compression:

Stored size: 1.59 KB

Contents

import { connect } from 'react-redux';
import React from 'react';
import Immutable from 'seamless-immutable';
import PropTypes from 'prop-types';
// eslint-disable-next-line import/no-extraneous-dependencies
import DonutChart from 'foremanReact/components/common/charts/DonutChart';
import AggregateStatus from './AggregateStatus/index.js';
import * as JobInvocationActions from '../../redux/actions/jobInvocations';

class JobInvocationContainer extends React.Component {
  componentDidMount() {
    const { startJobInvocationsPolling, data: { url } } = this.props;

    startJobInvocationsPolling(url);
  }

  render() {
    const { jobInvocations, statuses } = this.props;

    return (
      <div id="job_invocations_chart_container">
        <DonutChart data={Immutable.asMutable(jobInvocations)} />
        <AggregateStatus statuses={statuses} />
      </div>
    );
  }
}

const mapStateToProps = (state) => {
  const {
    jobInvocations,
    statuses,
  } = state.foremanRemoteExecutionReducers.jobInvocations;

  return {
    jobInvocations,
    statuses,
  };
};

JobInvocationContainer.propTypes = {
  startJobInvocationsPolling: PropTypes.func,
  data: PropTypes.string,
  jobInvocations: PropTypes.arrayOf(PropTypes.arrayOf(
    PropTypes.string,
    PropTypes.number,
    PropTypes.string,
  )),
  statuses: PropTypes.shape({}),
};

JobInvocationContainer.defaultProps = {
  startJobInvocationsPolling: JobInvocationActions.startJobInvocationsPolling,
  data: '',
  jobInvocations: [['property', 3, 'color']],
  statuses: {},
};
export default connect(mapStateToProps, JobInvocationActions)(JobInvocationContainer);

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
foreman_remote_execution-1.8.3 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.8.2 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.8.1 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.8.0 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.7.1 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.7.0 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.6.7 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.6.6 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.6.5 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.6.4 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.5.6 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.6.3 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.6.2 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.5.5 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.6.1 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.6.0 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.5.4 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.5.3 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.5.2 webpack/react_app/components/jobInvocations/index.js
foreman_remote_execution-1.5.1 webpack/react_app/components/jobInvocations/index.js