Sha256: 11d10f6f1e662781c70388bbb7b09e45d877f43faa188016c874d78a30a117a7

Contents?: true

Size: 1.83 KB

Versions: 15

Compression:

Stored size: 1.83 KB

Contents

import React from 'react';
import { Button } from '@patternfly/react-core';
import PropTypes from 'prop-types';
import { translate as __ } from 'foremanReact/common/I18n';
import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout';
import InsightsHeader from './Components/InsightsHeader';
import { NoTokenEmptyState } from './Components/NoTokenEmptyState';
import InsightsTable from './Components/InsightsTable';
import RemediationModal from './Components/RemediationModal';
import {
  INSIGHTS_SYNC_PAGE_TITLE,
  INSIGHTS_SEARCH_PROPS,
} from './InsightsCloudSyncConstants';
import './InsightsCloudSync.scss';

const InsightsCloudSync = ({
  syncInsights,
  query,
  fetchInsights,
  hasToken,
}) => {
  if (!hasToken) {
    return (
      <PageLayout header={INSIGHTS_SYNC_PAGE_TITLE} searchable={false}>
        <NoTokenEmptyState />
      </PageLayout>
    );
  }
  return (
    <div className="rh-cloud-insights">
      <PageLayout
        searchable
        searchProps={INSIGHTS_SEARCH_PROPS}
        onSearch={nextQuery => fetchInsights({ query: nextQuery, page: 1 })}
        header={INSIGHTS_SYNC_PAGE_TITLE}
        toolbarButtons={
          <>
            <RemediationModal />
            <Button
              variant="secondary"
              onClick={() => syncInsights(fetchInsights, query)}
            >
              {__('Start recommendations sync')}
            </Button>
          </>
        }
        searchQuery={query}
        beforeToolbarComponent={<InsightsHeader />}
      >
        <InsightsTable />
      </PageLayout>
    </div>
  );
};

InsightsCloudSync.propTypes = {
  syncInsights: PropTypes.func.isRequired,
  fetchInsights: PropTypes.func.isRequired,
  query: PropTypes.string,
  hasToken: PropTypes.bool,
};

InsightsCloudSync.defaultProps = {
  query: '',
  hasToken: true,
};

export default InsightsCloudSync;

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.33 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-3.0.32 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-3.0.29 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-3.0.28 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-3.0.26 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-3.0.25 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-4.0.25 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-3.0.24.1 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-4.0.24.1 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-3.0.24 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-4.0.24 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-3.0.23 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-4.0.23 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-3.0.22 webpack/InsightsCloudSync/InsightsCloudSync.js
foreman_rh_cloud-4.0.22 webpack/InsightsCloudSync/InsightsCloudSync.js