Sha256: 68f825a10841017454b70a12e2612115a9f8f4b5613fb1aa971d84cc1533b450

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 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="donunt-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

6 entries across 6 versions & 1 rubygems

Version Path
foreman_inventory_upload-1.0.0.beta7 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_inventory_upload-1.0.0.beta6 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_inventory_upload-1.0.0.beta5 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_inventory_upload-1.0.0.beta4 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_inventory_upload-1.0.0.beta3 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
foreman_inventory_upload-1.0.0.beta2 webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js