Sha256: f450729b548c6aa7787214740e8bac1c217131e01da20a3f946cf61a0482e159

Contents?: true

Size: 1.54 KB

Versions: 8

Compression:

Stored size: 1.54 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Card } from 'patternfly-react';
import classNames from 'classnames';
import { noop } from 'foremanReact/common/helpers';
import { translate as __ } from 'foremanReact/common/I18n';

import { TASKS_DASHBOARD_AVAILABLE_QUERY_STATES } from '../../../../TasksDashboardConstants';
import { queryPropType } from '../../../../TasksDashboardPropTypes';
import './ScheduledTasksCard.scss';

const ScheduledTasksCard = ({
  data,
  className,
  query,
  updateQuery,
  ...props
}) => {
  const { SCHEDULED } = TASKS_DASHBOARD_AVAILABLE_QUERY_STATES;
  const onClick = () => updateQuery({ state: SCHEDULED });

  return (
    <Card
      className={classNames(
        'tasks-donut-card',
        'scheduled-tasks-card',
        className,
        {
          'selected-tasks-card': query.state === SCHEDULED,
        }
      )}
      {...props}
    >
      <Card.Title onClick={onClick}>{__('Scheduled')}</Card.Title>
      <Card.Body>
        <div
          className={classNames('scheduled-data', {
            'not-focused': query.state && query.state !== SCHEDULED,
          })}
          onClick={onClick}
        >
          {data}
          <p>{__('Total')}</p>
        </div>
      </Card.Body>
    </Card>
  );
};

ScheduledTasksCard.propTypes = {
  data: PropTypes.number,
  query: queryPropType,
  className: PropTypes.string,
  updateQuery: PropTypes.func,
};

ScheduledTasksCard.defaultProps = {
  data: 0,
  query: {},
  className: '',
  updateQuery: noop,
};

export default ScheduledTasksCard;

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foreman-tasks-0.15.8 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.15.7 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.16.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.15.6 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.15.5 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.15.4 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.15.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.15.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js