Sha256: e63b3b2840c56d36b15fa7d36fce044111fa5ee70b115a27f138b27e2ef3ac66

Contents?: true

Size: 1.51 KB

Versions: 83

Compression:

Stored size: 1.51 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,
          'not-focused': query.state && query.state !== SCHEDULED,
        }
      )}
      {...props}
      id="scheduled-tasks-card"
    >
      <Card.Title onClick={onClick}>{__('Scheduled')}</Card.Title>
      <Card.Body>
        <div className="scheduled-data" 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

83 entries across 83 versions & 1 rubygems

Version Path
foreman-tasks-10.0.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-10.0.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.2.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.2.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.2.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.2.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.1.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.0.4 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.1.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.0.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.0.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-8.3.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-9.0.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-8.2.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-8.1.4 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-8.3.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-8.3.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-8.1.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-8.3.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-8.2.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js