Sha256: c20a7db2b49a3301fd6ab317c3d43a8216f04301b1f57922c81738262ca27539

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import Service from './Service';

const ServiceCounter = ({ title, serviceList }) => {
  if (serviceList === undefined || serviceList.length === 0) {
    return null;
  }
  const services = serviceList.map(service => (
    <Service
      key={service.id}
      name={service.name}
      currentCount={service.currentCount}
      minCount={Number(service.minCount)}
      maxCount={Number(service.maxCount)}
    />
  ));

  return (
    <div>
      <label className="service-counter-title">{title}</label>
      {services}
    </div>
  );
};

ServiceCounter.propTypes = {
  title: PropTypes.string.isRequired,
  serviceList: PropTypes.arrayOf(
    PropTypes.shape({
      id: PropTypes.number.isRequired,
      name: PropTypes.string.isRequired,
      currentCount: PropTypes.number.isRequired,
      minCount: PropTypes.string.isRequired,
      maxCount: PropTypes.string.isRequired,
    })
  ),
};

ServiceCounter.defaultProps = {
  serviceList: undefined,
};

export default ServiceCounter;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_acd-0.11.0 webpack/components/ApplicationInstance/components/ServiceCounter.js
foreman_acd-0.10.0 webpack/components/ApplicationInstance/components/ServiceCounter.js