Sha256: cd4c614009b2b07b3e05e7964b4d0fa429a381dac83952c2242259e371ef7e7f

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import PropTypes from 'prop-types';

import PreupgradeReports from './PreupgradeReports';

import getCsrfToken from '../../csrf';

import {
  selectPreupgradeReports,
  selectLoadingPreupgradeReports,
  selectError,
} from './PreupgradeReportsSelectors';

import { getPreupgradeReports } from './PreupgradeReportsActions';

const WrappedPreupgradeReports = ({ url, newJobInvocationUrl }) => {
  const loading = useSelector(state => selectLoadingPreupgradeReports(state));
  const preupgradeReports = useSelector(state =>
    selectPreupgradeReports(state)
  );
  const error = useSelector(state => selectError(state));

  const dispatch = useDispatch();

  useEffect(() => {
    dispatch(getPreupgradeReports(url));
  }, [url, dispatch]);

  return (
    <PreupgradeReports
      preupgradeReports={preupgradeReports}
      error={error}
      loading={loading}
      csrfToken={getCsrfToken()}
      newJobInvocationUrl={newJobInvocationUrl}
    />
  );
};

WrappedPreupgradeReports.propTypes = {
  url: PropTypes.string.isRequired,
  newJobInvocationUrl: PropTypes.string.isRequired,
};

export default WrappedPreupgradeReports;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_leapp-0.0.6 webpack/components/PreupgradeReports/index.js