Sha256: 9f8d2f06ac5ef2c666910a3c5b9c4664a71d9ea1a7af8b7cf48d5955f3c65a22

Contents?: true

Size: 1.26 KB

Versions: 59

Compression:

Stored size: 1.26 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Grid, DonutChart } from 'patternfly-react';
import { translate as __ } from 'foremanReact/common/I18n';
import './statusChart.scss';

const StatusChart = ({ completed }) => {
  const donutConfigData = {
    columns: [
      [__('Completed'), completed],
      [__('Remain'), 100 - completed],
    ],
    order: null,
  };

  const pfGetUtilizationDonutTooltipContents = d => {
    const {
      0: { name, value },
    } = d;
    return `<span class="donut-tooltip-pf" style="white-space: nowrap;">${value}% ${name}</span>`;
  };

  const donutConfigTooltip = {
    contents: pfGetUtilizationDonutTooltipContents,
  };

  return (
    <Grid.Col sm={4}>
      <div className="status-chart">
        <DonutChart
          id="donut-chart-1"
          size={{
            width: 210,
            height: 210,
          }}
          data={donutConfigData}
          tooltip={donutConfigTooltip}
          title={{
            type: 'percent',
            primary: `${completed}%`,
            secondary: __('Completed'),
          }}
        />
      </div>
    </Grid.Col>
  );
};

StatusChart.propTypes = {
  completed: PropTypes.number,
};

StatusChart.defaultProps = {
  completed: 0,
};

export default StatusChart;

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
foreman_rh_cloud-9.0.59 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-11.0.2 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-11.0.1 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-11.0.0 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-9.0.58 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-10.0.2 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-9.0.57 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-10.0.1 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-9.0.56 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-9.0.55 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-9.0.54 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-9.0.53 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-9.0.52 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-8.0.52 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-9.0.51 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-8.0.51 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-7.0.48 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-7.0.47 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-8.0.50 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-8.0.49 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js