Sha256: 60ad1c463f13b0d1fb40ab1fe69f9191e6c062b0a34faece0f83c08941c90403

Contents?: true

Size: 1.63 KB

Versions: 3

Compression:

Stored size: 1.63 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Alert, Button } from 'patternfly-react';
import { translate as __ } from 'foremanReact/common/I18n';

const RunningSteps = ({
  runningSteps,
  id,
  cancelStep,
  taskReload,
  taskProgressToggle,
}) => {
  if (!runningSteps.length) return <span>{__('No running steps')}</span>;
  return (
    <div>
      {runningSteps.map((step, i) => (
        <Alert type="warning" key={i}>
          {step.cancellable && (
            <p>
              <Button
                bsSize="small"
                onClick={() => {
                  if (!taskReload) {
                    taskProgressToggle();
                  }
                  cancelStep(id, step.id);
                }}
              >
                {__('Cancel')}
              </Button>
            </p>
          )}

          <p>
            <span>{__('Action')}:</span>
            <span />
          </p>
          <pre>{step.action_class}</pre>
          <p>
            <span>{__('State')}:</span>
            <span>{step.state}</span>
          </p>
          <span>{__('Input')}:</span>
          <span>
            <pre>{step.input}</pre>
          </span>
          <span>{__('Output')}:</span>
          <span>
            <pre>{step.output}</pre>
          </span>
        </Alert>
      ))}
    </div>
  );
};

RunningSteps.propTypes = {
  runningSteps: PropTypes.array,
  id: PropTypes.string.isRequired,
  cancelStep: PropTypes.func.isRequired,
  taskReload: PropTypes.bool.isRequired,
  taskProgressToggle: PropTypes.func.isRequired,
};

RunningSteps.defaultProps = {
  runningSteps: [],
};

export default RunningSteps;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman-tasks-2.0.3 webpack/ForemanTasks/Components/TaskDetails/Components/RunningSteps.js
foreman-tasks-2.0.2 webpack/ForemanTasks/Components/TaskDetails/Components/RunningSteps.js
foreman-tasks-2.0.1 webpack/ForemanTasks/Components/TaskDetails/Components/RunningSteps.js