Sha256: 89475f8884352e7cca5aa60d38c34716d3a4234a47eb89024aeee3a9f61c5521

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

import api from '../../../services/api';

import {
  REPOSITORY_SET_REPOSITORIES_REQUEST,
  REPOSITORY_SET_REPOSITORIES_SUCCESS,
  REPOSITORY_SET_REPOSITORIES_FAILURE,
  REPOSITORY_ENABLED,
} from '../../consts';

export const setRepositoryEnabled = repository => ({
  type: REPOSITORY_ENABLED,
  repository,
});

export function normalizeContentSetRepositories(repos, contentId, productId) {
  return repos.map(repo => ({
    contentId: parseInt(contentId, 10),
    productId: parseInt(productId, 10),
    arch: repo.substitutions.basearch,
    releasever: repo.substitutions.releasever,
    enabled: repo.enabled,
  }));
}

const loadRepositorySetRepos = (contentId, productId) => (dispatch) => {
  dispatch({
    type: REPOSITORY_SET_REPOSITORIES_REQUEST,
    contentId,
  });

  api
    .get(`/products/${productId}/repository_sets/${contentId}/available_repositories`)
    .then(({ data }) => {
      dispatch({
        type: REPOSITORY_SET_REPOSITORIES_SUCCESS,
        contentId,
        productId,
        results: data.results,
      });
    })
    .catch(({ response: { data: error } }) => {
      dispatch({
        type: REPOSITORY_SET_REPOSITORIES_FAILURE,
        contentId,
        error,
      });
    });
};

export default loadRepositorySetRepos;

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katello-3.8.1 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js
katello-3.7.1.1 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js
katello-3.7.1 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js
katello-3.8.0 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js
katello-3.8.0.rc3 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js
katello-3.8.0.rc2 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js
katello-3.7.0 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js
katello-3.8.0.rc1 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js
katello-3.7.0.rc2 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js
katello-3.7.0.rc1 webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js