Sha256: c0c870743f912d9cbffd11f848a0e2d2f0d2699ee386fa7d2f9d749c1cf4c71c

Contents?: true

Size: 1.59 KB

Versions: 22

Compression:

Stored size: 1.59 KB

Contents

import React from 'react';
import { isEmpty } from 'lodash';
import PropTypes from 'prop-types';

import EmptySyncResult from './components/EmptySyncResult';
import FinishedSyncResult from './components/FinishedSyncResult';

import './TemplateSyncResult.scss';

const TemplateSyncResult = ({
  syncResult: { templates, resultAction, repo, branch, gitUser, pagination },
  history,
  syncedTemplatesPageChange,
  editPaths,
  fileRepoStartWith,
}) => {
  const redirectBack = () => history.push({ pathname: '/template_syncs' });

  return isEmpty(templates) ? (
    <EmptySyncResult primaryAction={redirectBack} />
  ) : (
    <FinishedSyncResult
      templates={templates}
      type={resultAction}
      repo={repo}
      branch={branch}
      gitUser={gitUser}
      fileRepoStartWith={fileRepoStartWith}
      editPaths={editPaths}
      pagination={pagination}
      pageChange={syncedTemplatesPageChange}
    />
  );
};

TemplateSyncResult.propTypes = {
  syncResult: PropTypes.shape({
    templates: PropTypes.array,
    resultAction: PropTypes.string,
    repo: PropTypes.string,
    branch: PropTypes.string,
    gitUser: PropTypes.string,
    pagination: PropTypes.shape({
      page: PropTypes.number,
      perPage: PropTypes.number,
    }),
    syncedTemplatesPageChange: PropTypes.func,
  }).isRequired,
  history: PropTypes.object.isRequired,
  editPaths: PropTypes.object,
  fileRepoStartWith: PropTypes.array,
  syncedTemplatesPageChange: PropTypes.func,
};

TemplateSyncResult.defaultProps = {
  editPaths: {},
  syncedTemplatesPageChange: () => {},
  fileRepoStartWith: [],
};

export default TemplateSyncResult;

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
foreman_templates-10.0.2 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-10.0.1 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-10.0.0 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.5.1 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.5.0 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.3.3 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.3.2 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.3.1 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.4.0 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.3.0 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.2.0 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.1.0 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.0.2 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.0.1 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-9.0.0 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-7.0.7 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-8.0.0 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-7.0.6 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-7.0.5 webpack/components/TemplateSyncResult/TemplateSyncResult.js
foreman_templates-7.0.4 webpack/components/TemplateSyncResult/TemplateSyncResult.js