Sha256: 8c91c1425467a96dc49150c6c5c302e4a56b732a34e085a3ffbb784a7a2f1980

Contents?: true

Size: 1.42 KB

Versions: 18

Compression:

Stored size: 1.42 KB

Contents

import { API_OPERATIONS, get, post } from 'foremanReact/redux/API';
import { translate as __ } from 'foremanReact/common/I18n';
import api, { foremanApi, orgId } from '../../services/api';
import SMART_PROXY_CONTENT_KEY, { SMART_PROXY_COUNTS_UPDATE_KEY, SMART_PROXY_KEY } from './SmartProxyContentConstants';
import { renderTaskStartedToast } from '../Tasks/helpers';
import { getResponseErrorMsgs } from '../../utils/helpers';

const getSmartProxyContent = ({ smartProxyId, organizationId }) => get({
  type: API_OPERATIONS.GET,
  key: SMART_PROXY_CONTENT_KEY,
  url: api.getApiUrl(organizationId ? `/capsules/${smartProxyId}/content/sync?organization_id=${organizationId}` : `/capsules/${smartProxyId}/content/sync`),
});

export const getSmartProxies = () => get({
  type: API_OPERATIONS.GET,
  key: SMART_PROXY_KEY,
  url: foremanApi.getApiUrl('/smart_proxies'),
  params: { organization_id: orgId(), per_page: 'all' },
});

export const updateSmartProxyContentCounts = smartProxyId => post({
  type: API_OPERATIONS.POST,
  key: SMART_PROXY_COUNTS_UPDATE_KEY,
  url: api.getApiUrl(`/capsules/${smartProxyId}/content/update_counts`),
  handleSuccess: (response) => {
    renderTaskStartedToast(response?.data, __('Smart proxy content count refresh has started in the background'));
  },
  errorToast: error => __(`Something went wrong while refreshing content counts: ${getResponseErrorMsgs(error.response)}`),
});

export default getSmartProxyContent;

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
katello-4.14.1 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.14.0 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.14.0.rc3 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.14.0.rc2 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.14.0.rc1.1 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.14.0.rc1 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.13.1 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.13.0 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.12.1 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.13.0.rc1 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.12.0 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.12.0.rc3 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.12.0.rc2 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.12.0.rc1 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.11.1 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.11.0 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.11.0.rc2 webpack/scenes/SmartProxy/SmartProxyContentActions.js
katello-4.11.0.rc1 webpack/scenes/SmartProxy/SmartProxyContentActions.js