Sha256: 24c2402f2223aaef30a92f01b1ac195dd7e129781c0e0cee28bd0382d8887688

Contents?: true

Size: 1.19 KB

Versions: 49

Compression:

Stored size: 1.19 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Grid, DonutChart } from 'patternfly-react';
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

49 entries across 49 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.33 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.32 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.29 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.28 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.26 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.25 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.24.1 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-4.0.24.1 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.24 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-4.0.24 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.23 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-4.0.23 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.22 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-4.0.22 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-4.0.21.1 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.21.1 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.21 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.20 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-3.0.19 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_rh_cloud-2.0.18.1 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js