Sha256: 0f43c8c31fda2fd2df8ded81f0beb3e833bd3e3998c0c5ab0725889cd09b087d
Contents?: true
Size: 2 KB
Versions: 6
Compression:
Stored size: 2 KB
Contents
const repoTypeSearchQueryMap = { rpm: '(name !~ source rpm) and (name !~ debug rpm) and (content_type = yum)', sourceRpm: '(name ~ source rpm) and (content_type = yum)', debugRpm: '(name ~ debug rpm) and (content_type = yum)', kickstart: 'content_type = kickstart', ostree: 'content_type = ostree', beta: 'name ~ beta', }; const recommendedRepositorySetLables = [ 'rhel-7-server-rpms', 'rhel-6-server-rpms', 'rhel-6-server-satellite-tools-6.3-rpms', 'rhel-server-rhscl-7-rpms', 'rhel-7-server-satellite-capsule-6.3-rpms', 'rhel-7-server-satellite-capsule-6.4-rpms', 'rhel-7-server-satellite-tools-6.3-rpms', 'rhel-6-server-satellite-tools-6.3-rpms', 'rhel-7-server-ansible-2.5-rpms', 'rhel-7-server-optional-rpms', 'rhel-7-server-extras-rpms', 'rhel-5-server-els-rpms', 'rhel-7-server-eus-rpms', ]; const createLablesQuery = lables => lables.map(label => `label = ${label}`).join(' or '); const isRecommendedRepositorySet = ({ label }) => recommendedRepositorySetLables.includes(label); export const normalizeRepositorySets = (data) => { data.results.forEach((repositorySet) => { /* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["id"] }] */ repositorySet.id = parseInt(repositorySet.id, 10); repositorySet.recommended = isRecommendedRepositorySet(repositorySet); }); return data; }; const maptToSearchQuery = (filter) => { if (filter === 'other') { const joined = Object.keys(repoTypeSearchQueryMap) .map(k => repoTypeSearchQueryMap[k]) .map(q => `(${q})`) .join(' or '); return `not (${joined})`; } return repoTypeSearchQueryMap[filter]; }; export const repoTypeFilterToSearchQuery = filters => filters .map(f => `(${maptToSearchQuery(f)})`) .join(' or '); export const joinSearchQueries = parts => parts .filter(v => (v && v !== '')) .map(v => `(${v})`) .join(' and '); export const recommendedRepositorySetsQuery = createLablesQuery(recommendedRepositorySetLables); export default normalizeRepositorySets;
Version data entries
6 entries across 6 versions & 1 rubygems