Sha256: 612e4128045836ee78ab0cf165c814f3d05998bdeb04cdbe0c8d8f9ba45f2978

Contents?: true

Size: 912 Bytes

Versions: 6

Compression:

Stored size: 912 Bytes

Contents

import React from 'react';
import PropTypes from 'prop-types';
import Service from './Service';
import { arrayToObjectObj } from '../../../helper';
import { cloneDeep } from 'lodash';

const ServiceCounter= ({
  title,
  serviceList,
}) =>{
  if (serviceList == undefined || serviceList.length == 0) {
    return null;
  }
  const services = cloneDeep(arrayToObjectObj(serviceList, "id"));

  return (
    <div>
      <label class="service-counter-title">{title}</label>
    {Object.keys(services).map(key => (
      <Service
        key={services[key].id}
        name={services[key].name}
        currentCount={services[key].currentCount}
        minCount={Number(services[key].minCount)}
        maxCount={Number(services[key].maxCount)}
      />)
    )}
    </div>
  );
};

ServiceCounter.propTypes = {
  title: PropTypes.string.isRequired,
  serviceList: PropTypes.array,
};

export default ServiceCounter;

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_acd-0.7.0 webpack/components/ApplicationInstance/components/ServiceCounter.js
foreman_acd-0.6.0 webpack/components/ApplicationInstance/components/ServiceCounter.js
foreman_acd-0.5.0 webpack/components/ApplicationInstance/components/ServiceCounter.js
foreman_acd-0.4.0 webpack/components/ApplicationInstance/components/ServiceCounter.js
foreman_acd-0.3.0 webpack/components/ApplicationInstance/components/ServiceCounter.js
foreman_acd-0.2.1 webpack/components/ApplicationInstance/components/ServiceCounter.js