Sha256: 8bf6fbfe831648e87bc8f6749fff21e089507f535ea63aa1d0d52a026d09d612

Contents?: true

Size: 1.51 KB

Versions: 25

Compression:

Stored size: 1.51 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

import { Icon, Button, OverlayTrigger, Tooltip } from 'patternfly-react';
import { translate as __ } from 'foremanReact/common/I18n';
import {
  TASKS_DASHBOARD_AVAILABLE_QUERY_STATES,
  TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS,
} from '../../../../TasksDashboardConstants';
import { queryPropType } from '../../../../TasksDashboardPropTypes';

const tooltip = (
  <Tooltip id="stopped-tooltip">
    {__('Other includes all stopped tasks that are cancelled or pending')}
  </Tooltip>
);

export const OtherInfo = ({ updateQuery, otherCount, query }) => {
  const { OTHER } = TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS;
  const { STOPPED } = TASKS_DASHBOARD_AVAILABLE_QUERY_STATES;
  const active = query.state === STOPPED && query.result === OTHER;
  return (
    <span className={classNames(active && 'other-active')}>
      <OverlayTrigger
        overlay={tooltip}
        trigger={['hover', 'focus']}
        placement="bottom"
      >
        <span>
          <Icon type="pf" name="info" />
          <span>{__('Other:')} </span>
        </span>
      </OverlayTrigger>
      <Button
        bsStyle="link"
        onClick={() =>
          updateQuery({
            state: STOPPED,
            result: OTHER,
          })
        }
      >
        {otherCount}
      </Button>
    </span>
  );
};
OtherInfo.propTypes = {
  updateQuery: PropTypes.func.isRequired,
  otherCount: PropTypes.number.isRequired,
  query: queryPropType.isRequired,
};

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
foreman-tasks-4.1.6 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-5.2.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-6.0.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-5.2.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-6.0.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-5.2.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-5.3.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-5.2.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-5.1.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-5.1.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-4.1.5 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-4.1.4 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-4.1.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-3.0.6 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-5.0.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-4.1.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-4.1.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-4.0.1 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-4.1.0 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js
foreman-tasks-3.0.5 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js