import React from 'react';
import { useFormApi } from '@data-driven-forms/react-form-renderer';
import { Alert, Panel, PanelMain, Spinner } from '@patternfly/react-core';
import {
TableComposable,
Tbody,
Td,
Th,
Thead,
Tr,
} from '@patternfly/react-table';
import PropTypes from 'prop-types';
import { UNIT_GIB, UNIT_MIB } from '../../../constants';
import { useListRepositoriesQuery } from '../../../store/contentSourcesApi';
const RepoName = ({ repoUrl }) => {
const { data, isSuccess, isFetching, isError } = useListRepositoriesQuery({
url: repoUrl,
});
return (
<>
{isSuccess &&
{data.data?.[0].name}
}
{isFetching && }
{isError && (
)}
>
);
};
export const FSReviewTable = () => {
const { getState } = useFormApi();
const fsc = getState().values['file-system-configuration'];
return (
| Mount point |
File system type |
Minimum size |
{fsc.map((partition, partitionIndex) => (
| {partition.mountpoint} |
xfs |
{partition.size}{' '}
{partition.unit === UNIT_GIB
? 'GiB'
: partition.unit === UNIT_MIB
? 'MiB'
: 'KiB'}
|
))}
);
};
export const PackagesTable = () => {
const { getState } = useFormApi();
const packages = getState()?.values['selected-packages'];
return (
| Name |
{packages.map((pkg, pkgIndex) => (
| {pkg.name} |
))}
);
};
export const RepositoriesTable = () => {
const { getState } = useFormApi();
const repositories = getState()?.values?.['payload-repositories'];
return (
| Name |
{repositories.map((repo, repoIndex) => (
|
|
))}
);
};
RepoName.propTypes = {
repoUrl: PropTypes.string,
};