Sha256: 0e80e35ca67b5b21aa0f2929fe022ce8284f16c7cae778a9240866ce7cc44c17

Contents?: true

Size: 1.85 KB

Versions: 18

Compression:

Stored size: 1.85 KB

Contents

import { foremanUrl } from 'foremanReact/common/helpers';
import { get, post, put } from 'foremanReact/redux/API';
import { translate as __ } from 'foremanReact/common/I18n';

import {
  CHANGE_CONTENT_SOURCE_DATA,
  CHANGE_CONTENT_SOURCE_PROXY,
  CHANGE_CONTENT_SOURCE,
  CHANGE_CONTENT_SOURCE_VIEWS,
} from './constants';

export const getFormData = (hostIds, search) => (post({
  key: CHANGE_CONTENT_SOURCE_DATA,
  url: foremanUrl('/change_host_content_source/data'),
  params: { host_ids: hostIds, search },
  errorToast: () => __('Something went wrong while getting the data. See the logs for more information'),
}));

export const changeContentSource =
  (environmentId, contentViewId, contentSourceId, hostIds, handleSuccess, successToast) =>
    put({
      key: CHANGE_CONTENT_SOURCE,
      url: foremanUrl('/api/v2/hosts/bulk/change_content_source'),
      params: {
        environment_id: environmentId,
        content_view_id: contentViewId,
        content_source_id: contentSourceId,
        host_ids: hostIds,
      },
      errorToast: () => __('Something went wrong while updating the content source. See the logs for more information'),
      successToast,
      handleSuccess,
    });

export const getProxy = id =>
  get({
    key: CHANGE_CONTENT_SOURCE_PROXY,
    url: foremanUrl(`/katello/api/capsules/${id}`),
    errorToast: () => __('Something went wrong while loading the Smart Proxy. See the logs for more information'),
  });

export const getContentViews = environmentId =>
  get({
    key: CHANGE_CONTENT_SOURCE_VIEWS,
    url: foremanUrl('/katello/api/v2/content_views'),
    params: {
      environment_id: environmentId,
      full_result: true,
      order: 'default DESC', // shows the default CV before all other options
    },
    errorToast: () => __('Something went wrong while loading the content views. See the logs for more information'),
  });

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
katello-4.16.0 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.15.1 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.16.0.rc2 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.16.0.rc1 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.14.3 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.14.2 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.15.0 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.15.0.rc2 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.15.0.rc1 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.14.1 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.14.0 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.14.0.rc3 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.14.0.rc2 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.14.0.rc1.1 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.14.0.rc1 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.13.1 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.13.0 webpack/scenes/Hosts/ChangeContentSource/actions.js
katello-4.13.0.rc1 webpack/scenes/Hosts/ChangeContentSource/actions.js