webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeActions.js in katello-4.10.0 vs webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeActions.js in katello-4.11.0.rc1
- old
+ new
@@ -1,37 +1,59 @@
import { translate as __ } from 'foremanReact/common/I18n';
import { API_OPERATIONS, put } from 'foremanReact/redux/API';
import api, { foremanApi } from '../../../../../services/api';
import HOST_DETAILS_KEY from '../../HostDetailsConstants';
-import { ORGANIZATION, AVAILABLE_RELEASE_VERSIONS } from './SystemPurposeConstants';
+import { ACTIVATION_KEY } from '../../../../../scenes/ActivationKeys/Details/ActivationKeyConstants';
+import { ORGANIZATION, AVAILABLE_RELEASE_VERSIONS, RELEASES } from './SystemPurposeConstants';
import { errorToast } from '../../../../../scenes/Tasks/helpers';
export const getOrganization = ({ orgId }) => ({
type: 'API_GET',
payload: {
key: `${ORGANIZATION}_${orgId}`,
url: api.getApiUrl(`/organizations/${orgId}`),
},
});
-export const getAvailableReleaseVersions = ({ hostId }) => ({
+export const getHostAvailableReleaseVersions = ({ id }) => ({
type: 'API_GET',
payload: {
- key: `${AVAILABLE_RELEASE_VERSIONS}_${hostId}`,
- url: foremanApi.getApiUrl(`/hosts/${hostId}/subscriptions/available_release_versions`),
+ key: `${AVAILABLE_RELEASE_VERSIONS}_${id}`,
+ url: foremanApi.getApiUrl(`/hosts/${id}/subscriptions/available_release_versions`),
},
});
-export const updateSystemPurposeAttributes = ({ hostId, attributes, refreshHostDetails }) => put({
+export const getAKAvailableReleaseVersions = ({ id }) => ({
+ type: API_OPERATIONS.GET,
+ payload: {
+ key: `${RELEASES}_${id}`,
+ url: api.getApiUrl(`/activation_keys/${id}/releases`),
+ },
+});
+
+export const updateHostSysPurposeAttributes = ({ id, attributes, refreshHostDetails }) => put({
type: API_OPERATIONS.PUT,
key: HOST_DETAILS_KEY,
- url: foremanApi.getApiUrl(`/hosts/${hostId}`),
+ url: foremanApi.getApiUrl(`/hosts/${id}`),
params: {
- id: hostId,
+ id,
host: {
subscription_facet_attributes: attributes,
},
},
successToast: () => __('System purpose attributes updated'),
errorToast,
handleSuccess: refreshHostDetails,
+});
+
+export const updateAKSysPurposeAttributes = ({ id, attributes, refreshAKDetails }) => put({
+ type: API_OPERATIONS.PUT,
+ key: ACTIVATION_KEY,
+ url: api.getApiUrl(`/activation_keys/${id}`),
+ params: {
+ id,
+ activation_key: attributes,
+ },
+ successToast: () => __('System purpose attributes updated'),
+ errorToast,
+ handleSuccess: refreshAKDetails,
});