Sha256: 83803674d78763bcfa49269a367e5774791f0a8a86a5ae664a1f852414f62f5d

Contents?: true

Size: 1.45 KB

Versions: 9

Compression:

Stored size: 1.45 KB

Contents

import React from 'react';
import { connect } from 'react-redux';
import { compose, bindActionCreators } from 'redux';

import { callOnMount, callOnPopState } from 'foremanReact/common/HOC';
import { useForemanContext } from 'foremanReact/Root/Context/ForemanContext';

import WebhooksIndexPage from './WebhooksIndexPage';
import * as actions from '../WebhooksPageActions';

import {
  selectWebhooks,
  selectPage,
  selectPerPage,
  selectSearch,
  selectSort,
  selectHasData,
  selectHasError,
  selectIsLoading,
  selectSubtotal,
  selectMessage,
  selectCanCreate,
} from '../WebhooksPageSelectors';

const mapStateToProps = state => ({
  webhooks: selectWebhooks(state),
  page: selectPage(state),
  perPage: selectPerPage(state),
  search: selectSearch(state),
  sort: selectSort(state),
  isLoading: selectIsLoading(state),
  hasData: selectHasData(state),
  hasError: selectHasError(state),
  itemCount: selectSubtotal(state),
  message: selectMessage(state),
  canCreate: selectCanCreate(state),
});

const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);

const callWithToastsContext = Component => props => {
  const { toasts } = useForemanContext();
  return <Component {...props} toasts={toasts} />;
};

export default compose(
  connect(mapStateToProps, mapDispatchToProps),
  callWithToastsContext,
  callOnMount(({ initializeWebhooks }) => initializeWebhooks()),
  callOnPopState(({ fetchWebhooks }) => fetchWebhooks())
)(WebhooksIndexPage);

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_webhooks-2.0.3 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js
foreman_webhooks-2.0.2 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js
foreman_webhooks-2.0.1 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js
foreman_webhooks-2.0.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js
foreman_webhooks-1.1.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js
foreman_webhooks-1.0.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js
foreman_webhooks-0.0.3 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js
foreman_webhooks-0.0.2 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js
foreman_webhooks-0.0.1 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js