Sha256: 329d7e02ef7a49c2a7f7996406d08c47ff2f4d85bcfc0583b246206649b1e356

Contents?: true

Size: 823 Bytes

Versions: 9

Compression:

Stored size: 823 Bytes

Contents

import Immutable from 'seamless-immutable';
import { STATUS } from 'foremanReact/constants';
import {
  INVENTORY_SYNC_REQUEST,
  INVENTORY_SYNC_SUCCESS,
  INVENTORY_SYNC_FAILURE,
} from './SyncButtonConstants';

export default (
  state = Immutable({}),
  { type, payload: { syncHosts, disconnectHosts, error } = {} }
) => {
  switch (type) {
    case INVENTORY_SYNC_REQUEST:
      return state.merge({
        ...state,
        status: STATUS.PENDING,
        error: null,
      });
    case INVENTORY_SYNC_SUCCESS:
      return state.merge({
        ...state,
        status: STATUS.RESOLVED,
        syncHosts,
        disconnectHosts,
      });
    case INVENTORY_SYNC_FAILURE:
      return state.merge({
        ...state,
        status: STATUS.ERROR,
        error,
      });
    default:
      return state;
  }
};

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_rh_cloud-0.9.12 webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
foreman_rh_cloud-1.0.12 webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
foreman_rh_cloud-2.0.12 webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
foreman_rh_cloud-0.9.11 webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
foreman_rh_cloud-1.0.11 webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
foreman_rh_cloud-2.0.11 webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
foreman_rh_cloud-0.9.10 webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
foreman_rh_cloud-1.0.10 webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
foreman_rh_cloud-2.0.10 webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js