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-2.0.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-1.1.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-1.1.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-2.0.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-2.0.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-1.2.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-1.1.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-1.1.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.17.6 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-1.0.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-1.0.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.17.5 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.17.4 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.17.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.17.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.16.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.17.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.15.11 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.16.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js
foreman-tasks-0.15.10 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.js