Merge bfb6757d4f into 7391652e17
This commit is contained in:
commit
d2b08cf6f4
5 changed files with 81 additions and 5 deletions
|
|
@ -23,6 +23,7 @@ import { ExternalLinkAltIcon } from '@patternfly/react-icons';
|
||||||
import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
|
import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
|
||||||
|
|
||||||
import { BulkSelect } from './components/BulkSelect';
|
import { BulkSelect } from './components/BulkSelect';
|
||||||
|
import CommunityRepositoryLabel from './components/CommunityRepositoryLabel';
|
||||||
import Empty from './components/Empty';
|
import Empty from './components/Empty';
|
||||||
import { Error } from './components/Error';
|
import { Error } from './components/Error';
|
||||||
import { Loading } from './components/Loading';
|
import { Loading } from './components/Loading';
|
||||||
|
|
@ -63,6 +64,7 @@ import {
|
||||||
} from '../../../../store/wizardSlice';
|
} from '../../../../store/wizardSlice';
|
||||||
import { releaseToVersion } from '../../../../Utilities/releaseToVersion';
|
import { releaseToVersion } from '../../../../Utilities/releaseToVersion';
|
||||||
import useDebounce from '../../../../Utilities/useDebounce';
|
import useDebounce from '../../../../Utilities/useDebounce';
|
||||||
|
import { useFlag } from '../../../../Utilities/useGetEnvironment';
|
||||||
|
|
||||||
const Repositories = () => {
|
const Repositories = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
@ -89,6 +91,14 @@ const Repositories = () => {
|
||||||
>('toggle-group-all');
|
>('toggle-group-all');
|
||||||
const [isTemplateSelected, setIsTemplateSelected] = useState(false);
|
const [isTemplateSelected, setIsTemplateSelected] = useState(false);
|
||||||
|
|
||||||
|
const isSharedEPELEnabled = useFlag('image-builder.shared-epel.enabled');
|
||||||
|
|
||||||
|
const originParam = useMemo(() => {
|
||||||
|
const origins = [ContentOrigin.CUSTOM];
|
||||||
|
if (isSharedEPELEnabled) origins.push(ContentOrigin.COMMUNITY);
|
||||||
|
return origins.join(',');
|
||||||
|
}, [isSharedEPELEnabled]);
|
||||||
|
|
||||||
const debouncedFilterValue = useDebounce(filterValue);
|
const debouncedFilterValue = useDebounce(filterValue);
|
||||||
|
|
||||||
const { data: repositoryParameters } = useListRepositoryParametersQuery();
|
const { data: repositoryParameters } = useListRepositoryParametersQuery();
|
||||||
|
|
@ -144,7 +154,7 @@ const Repositories = () => {
|
||||||
{
|
{
|
||||||
availableForArch: arch,
|
availableForArch: arch,
|
||||||
availableForVersion: version,
|
availableForVersion: version,
|
||||||
origin: ContentOrigin.CUSTOM,
|
origin: originParam,
|
||||||
limit: 999, // O.O Oh dear, if possible this whole call should be removed
|
limit: 999, // O.O Oh dear, if possible this whole call should be removed
|
||||||
offset: 0,
|
offset: 0,
|
||||||
uuid: [...initialSelectedState].join(','),
|
uuid: [...initialSelectedState].join(','),
|
||||||
|
|
@ -173,7 +183,7 @@ const Repositories = () => {
|
||||||
availableForArch: arch,
|
availableForArch: arch,
|
||||||
availableForVersion: version,
|
availableForVersion: version,
|
||||||
contentType: 'rpm',
|
contentType: 'rpm',
|
||||||
origin: ContentOrigin.CUSTOM,
|
origin: originParam,
|
||||||
limit: perPage,
|
limit: perPage,
|
||||||
offset: perPage * (page - 1),
|
offset: perPage * (page - 1),
|
||||||
search: debouncedFilterValue,
|
search: debouncedFilterValue,
|
||||||
|
|
@ -652,6 +662,22 @@ const Repositories = () => {
|
||||||
{name}
|
{name}
|
||||||
{origin === ContentOrigin.UPLOAD ? (
|
{origin === ContentOrigin.UPLOAD ? (
|
||||||
<UploadRepositoryLabel />
|
<UploadRepositoryLabel />
|
||||||
|
) : origin === ContentOrigin.COMMUNITY ? (
|
||||||
|
<>
|
||||||
|
<CommunityRepositoryLabel />
|
||||||
|
<br />
|
||||||
|
<Button
|
||||||
|
component='a'
|
||||||
|
target='_blank'
|
||||||
|
variant='link'
|
||||||
|
icon={<ExternalLinkAltIcon />}
|
||||||
|
iconPosition='right'
|
||||||
|
isInline
|
||||||
|
href={url}
|
||||||
|
>
|
||||||
|
{url}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<br />
|
<br />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { Label, Tooltip } from '@patternfly/react-core';
|
||||||
|
import { RepositoryIcon } from '@patternfly/react-icons';
|
||||||
|
|
||||||
|
import ManageRepositoriesButton from './ManageRepositoriesButton';
|
||||||
|
|
||||||
|
const CommunityRepositoryLabel = () => {
|
||||||
|
return (
|
||||||
|
<Tooltip
|
||||||
|
content={
|
||||||
|
<>
|
||||||
|
Community repository: This EPEL repository is shared across
|
||||||
|
organizations.
|
||||||
|
<ManageRepositoriesButton />
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Label
|
||||||
|
variant='outline'
|
||||||
|
isCompact
|
||||||
|
icon={<RepositoryIcon />}
|
||||||
|
style={{ marginLeft: '8px' }}
|
||||||
|
>
|
||||||
|
Community
|
||||||
|
</Label>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CommunityRepositoryLabel;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React from 'react';
|
import React, { useMemo } from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
|
|
@ -8,6 +8,7 @@ import {
|
||||||
Spinner,
|
Spinner,
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
|
import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
|
||||||
|
import { useFlag } from '@unleash/proxy-client-react';
|
||||||
|
|
||||||
import { ContentOrigin } from '../../../../constants';
|
import { ContentOrigin } from '../../../../constants';
|
||||||
import {
|
import {
|
||||||
|
|
@ -33,12 +34,20 @@ type repoPropType = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const RepoName = ({ repoUuid }: repoPropType) => {
|
const RepoName = ({ repoUuid }: repoPropType) => {
|
||||||
|
const isSharedEPELEnabled = useFlag('image-builder.shared-epel.enabled');
|
||||||
|
|
||||||
|
const originParam = useMemo(() => {
|
||||||
|
const origins = [ContentOrigin.ALL];
|
||||||
|
if (isSharedEPELEnabled) origins.push(ContentOrigin.COMMUNITY);
|
||||||
|
return origins.join(',');
|
||||||
|
}, [isSharedEPELEnabled]);
|
||||||
|
|
||||||
const { data, isSuccess, isFetching, isError } = useListRepositoriesQuery(
|
const { data, isSuccess, isFetching, isError } = useListRepositoriesQuery(
|
||||||
{
|
{
|
||||||
// @ts-ignore if repoUrl is undefined the query is going to get skipped, so it's safe to ignore the linter here
|
// @ts-ignore if repoUrl is undefined the query is going to get skipped, so it's safe to ignore the linter here
|
||||||
uuid: repoUuid ?? '',
|
uuid: repoUuid ?? '',
|
||||||
contentType: 'rpm',
|
contentType: 'rpm',
|
||||||
origin: ContentOrigin.ALL,
|
origin: originParam,
|
||||||
},
|
},
|
||||||
{ skip: !repoUuid },
|
{ skip: !repoUuid },
|
||||||
);
|
);
|
||||||
|
|
@ -135,6 +144,14 @@ export const SnapshotTable = ({
|
||||||
{ refetchOnMountOrArgChange: true, skip: template === '' },
|
{ refetchOnMountOrArgChange: true, skip: template === '' },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isSharedEPELEnabled = useFlag('image-builder.shared-epel.enabled');
|
||||||
|
|
||||||
|
const originParam = useMemo(() => {
|
||||||
|
const origins = [ContentOrigin.REDHAT + ',' + ContentOrigin.CUSTOM];
|
||||||
|
if (isSharedEPELEnabled) origins.push(ContentOrigin.COMMUNITY);
|
||||||
|
return origins.join(',');
|
||||||
|
}, [isSharedEPELEnabled]);
|
||||||
|
|
||||||
const { data, isSuccess, isLoading, isError } = useListRepositoriesQuery({
|
const { data, isSuccess, isLoading, isError } = useListRepositoriesQuery({
|
||||||
uuid:
|
uuid:
|
||||||
snapshotForDate.length > 0
|
snapshotForDate.length > 0
|
||||||
|
|
@ -142,7 +159,7 @@ export const SnapshotTable = ({
|
||||||
: template && templateData && templateData.repository_uuids
|
: template && templateData && templateData.repository_uuids
|
||||||
? templateData.repository_uuids.join(',')
|
? templateData.repository_uuids.join(',')
|
||||||
: '',
|
: '',
|
||||||
origin: ContentOrigin.REDHAT + ',' + ContentOrigin.CUSTOM, // Make sure to show both redhat and external
|
origin: originParam, // Make sure to show redhat, external, and shared epel (if enabled)
|
||||||
});
|
});
|
||||||
|
|
||||||
const isAfterSet = new Set(
|
const isAfterSet = new Set(
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ export const useFlagWithEphemDefault = (
|
||||||
const onPremFlag = (flag: string): boolean => {
|
const onPremFlag = (flag: string): boolean => {
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
case 'image-builder.templates.enabled':
|
case 'image-builder.templates.enabled':
|
||||||
|
case 'image-builder.shared-epel.enabled':
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -295,6 +295,7 @@ export enum ContentOrigin {
|
||||||
'REDHAT' = 'red_hat',
|
'REDHAT' = 'red_hat',
|
||||||
'EXTERNAL' = 'external', // custom only
|
'EXTERNAL' = 'external', // custom only
|
||||||
'UPLOAD' = 'upload', // custom upload repo
|
'UPLOAD' = 'upload', // custom upload repo
|
||||||
|
'COMMUNITY' = 'community', // shared epel repos
|
||||||
'CUSTOM' = 'external,upload',
|
'CUSTOM' = 'external,upload',
|
||||||
'ALL' = 'red_hat,external,upload',
|
'ALL' = 'red_hat,external,upload',
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue