API: Add programatically generated Provisioning API slice definitions
These definitions were generated using the RTKQ code generation tool and will replace the existing definitions.
This commit is contained in:
parent
74528356fa
commit
702b667dc5
20 changed files with 2020 additions and 89 deletions
|
|
@ -1,10 +0,0 @@
|
|||
import {useGetSourceDetailQuery} from "../../../store/apiSlice";
|
||||
|
||||
type AWSAccountIdProps = {
|
||||
sourceId: string
|
||||
}
|
||||
|
||||
export const AWSAccountId = ({ sourceId }: AWSAccountIdProps) => {
|
||||
const { data } = useGetSourceDetailQuery(sourceId);
|
||||
return <>{data?.aws?.account_id}</>;
|
||||
};
|
||||
|
|
@ -14,9 +14,9 @@ import {
|
|||
import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
useGetSourceDetailQuery,
|
||||
useGetSourcesQuery,
|
||||
} from '../../../store/apiSlice';
|
||||
useGetSourceListQuery,
|
||||
useGetSourceUploadInfoQuery,
|
||||
} from '../../../store/provisioningApi';
|
||||
|
||||
export const AWSSourcesSelect = ({
|
||||
label,
|
||||
|
|
@ -37,16 +37,19 @@ export const AWSSourcesSelect = ({
|
|||
isSuccess,
|
||||
isError,
|
||||
refetch,
|
||||
} = useGetSourcesQuery('aws');
|
||||
} = useGetSourceListQuery({ provider: 'aws' });
|
||||
|
||||
const {
|
||||
data: sourceDetails,
|
||||
isFetching: isFetchingDetails,
|
||||
isSuccess: isSuccessDetails,
|
||||
isError: isErrorDetails,
|
||||
} = useGetSourceDetailQuery(selectedSourceId, {
|
||||
skip: !selectedSourceId,
|
||||
});
|
||||
} = useGetSourceUploadInfoQuery(
|
||||
{ id: selectedSourceId },
|
||||
{
|
||||
skip: !selectedSourceId,
|
||||
}
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (isFetchingDetails || !isSuccessDetails) return;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
import React from 'react';
|
||||
|
||||
import {useGetSourceUploadInfoQuery} from "../../../store/provisioningApi";
|
||||
|
||||
type AwsAccountIdProps = {
|
||||
sourceId: number
|
||||
}
|
||||
|
||||
export const AwsAccountId = ({ sourceId }: AwsAccountIdProps) => {
|
||||
const { data } = useGetSourceUploadInfoQuery({ id: sourceId });
|
||||
return <>{data?.aws?.account_id}</>;
|
||||
};
|
||||
|
|
@ -12,7 +12,7 @@ import {
|
|||
} from '@patternfly/react-core';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { useGetSourceDetailQuery } from '../../../store/apiSlice';
|
||||
import { useGetSourceUploadInfoQuery } from '../../../store/provisioningApi';
|
||||
|
||||
const AzureResourceGroups = ({ label, isRequired, className, ...props }) => {
|
||||
const { change, getState } = useFormApi();
|
||||
|
|
@ -25,8 +25,8 @@ const AzureResourceGroups = ({ label, isRequired, className, ...props }) => {
|
|||
setSourceId(values['azure-sources-select']);
|
||||
};
|
||||
|
||||
const { data: sourceDetails, isFetching } = useGetSourceDetailQuery(
|
||||
sourceId,
|
||||
const { data: sourceDetails, isFetching } = useGetSourceUploadInfoQuery(
|
||||
{ id: sourceId },
|
||||
{
|
||||
skip: !sourceId,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ import {
|
|||
import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
useGetSourcesQuery,
|
||||
useGetSourceDetailQuery,
|
||||
} from '../../../store/apiSlice';
|
||||
useGetSourceListQuery,
|
||||
useGetSourceUploadInfoQuery,
|
||||
} from '../../../store/provisioningApi';
|
||||
|
||||
const AzureSourcesSelect = ({ label, isRequired, className, ...props }) => {
|
||||
const { change } = useFormApi();
|
||||
|
|
@ -30,16 +30,19 @@ const AzureSourcesSelect = ({ label, isRequired, className, ...props }) => {
|
|||
isSuccess,
|
||||
isError,
|
||||
refetch,
|
||||
} = useGetSourcesQuery('azure');
|
||||
} = useGetSourceListQuery({ provider: 'azure' });
|
||||
|
||||
const {
|
||||
data: sourceDetails,
|
||||
isFetching: isFetchingDetails,
|
||||
isSuccess: isSuccessDetails,
|
||||
isError: isErrorDetails,
|
||||
} = useGetSourceDetailQuery(selectedSourceId, {
|
||||
skip: !selectedSourceId,
|
||||
});
|
||||
} = useGetSourceUploadInfoQuery(
|
||||
{ id: selectedSourceId },
|
||||
{
|
||||
skip: !selectedSourceId,
|
||||
}
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (isFetchingDetails || !isSuccessDetails) return;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import { ExclamationTriangleIcon, HelpIcon } from '@patternfly/react-icons';
|
|||
import PropTypes from 'prop-types';
|
||||
|
||||
import ActivationKeyInformation from './ActivationKeyInformation';
|
||||
import { AWSAccountId } from './AWSAccountId';
|
||||
import { AwsAccountId } from './AwsAccountId';
|
||||
import {
|
||||
FSReviewTable,
|
||||
PackagesTable,
|
||||
|
|
@ -26,7 +26,7 @@ import {
|
|||
} from './ReviewStepTables';
|
||||
|
||||
import { RELEASES, UNIT_GIB } from '../../../constants';
|
||||
import { useGetSourcesQuery } from '../../../store/apiSlice';
|
||||
import { useGetSourceListQuery } from '../../../store/provisioningApi';
|
||||
import { useShowActivationKeyQuery } from '../../../store/rhsmApi';
|
||||
import { useGetEnvironment } from '../../../Utilities/useGetEnvironment';
|
||||
import { googleAccType } from '../steps/googleCloud';
|
||||
|
|
@ -64,7 +64,9 @@ export const ImageOutputList = () => {
|
|||
};
|
||||
|
||||
export const TargetEnvAWSList = () => {
|
||||
const { data: awsSources, isSuccess } = useGetSourcesQuery();
|
||||
const { data: awsSources, isSuccess } = useGetSourceListQuery({
|
||||
provider: 'aws',
|
||||
});
|
||||
const { isBeta } = useGetEnvironment();
|
||||
|
||||
const { getState } = useFormApi();
|
||||
|
|
@ -92,7 +94,7 @@ export const TargetEnvAWSList = () => {
|
|||
getState()?.values?.['aws-target-type'] ===
|
||||
'aws-target-type-source' &&
|
||||
isSuccess && (
|
||||
<AWSAccountId
|
||||
<AwsAccountId
|
||||
sourceId={getState()?.values?.['aws-sources-select']}
|
||||
/>
|
||||
)}
|
||||
|
|
@ -169,7 +171,7 @@ export const TargetEnvGCPList = () => {
|
|||
export const TargetEnvAzureList = () => {
|
||||
const { getState } = useFormApi();
|
||||
const { data: azureSources, isSuccess: isSuccessAzureSources } =
|
||||
useGetSourcesQuery('azure');
|
||||
useGetSourceListQuery({ provider: 'azure' });
|
||||
return (
|
||||
<TextContent>
|
||||
<Text component={TextVariants.h3}>Microsoft Azure</Text>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {
|
|||
import { HelpIcon } from '@patternfly/react-icons';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { usePrefetch } from '../../../store/apiSlice';
|
||||
import { provisioningApi } from '../../../store/provisioningApi';
|
||||
|
||||
const TargetEnvironment = ({ label, isRequired, ...props }) => {
|
||||
const { getState, change } = useFormApi();
|
||||
|
|
@ -29,7 +29,7 @@ const TargetEnvironment = ({ label, isRequired, ...props }) => {
|
|||
'guest-image': false,
|
||||
'image-installer': false,
|
||||
});
|
||||
const prefetchSources = usePrefetch('getSources');
|
||||
const prefetchSources = provisioningApi.usePrefetch('getSourceList');
|
||||
|
||||
useEffect(() => {
|
||||
if (getState()?.values?.[input.name]) {
|
||||
|
|
@ -76,7 +76,7 @@ const TargetEnvironment = ({ label, isRequired, ...props }) => {
|
|||
}
|
||||
onClick={() => handleSetEnvironment('aws', !environment.aws)}
|
||||
onKeyDown={(e) => handleKeyDown(e, 'aws', !environment.aws)}
|
||||
onMouseEnter={() => prefetchSources('aws')}
|
||||
onMouseEnter={() => prefetchSources({ provider: 'aws' })}
|
||||
isSelected={environment.aws}
|
||||
isStacked
|
||||
isDisplayLarge
|
||||
|
|
@ -96,6 +96,7 @@ const TargetEnvironment = ({ label, isRequired, ...props }) => {
|
|||
onClick={() => handleSetEnvironment('gcp', !environment.gcp)}
|
||||
isSelected={environment.gcp}
|
||||
onKeyDown={(e) => handleKeyDown(e, 'gcp', !environment.gcp)}
|
||||
onMouseEnter={() => prefetchSources({ provider: 'gcp' })}
|
||||
isStacked
|
||||
isDisplayLarge
|
||||
/>
|
||||
|
|
@ -113,7 +114,7 @@ const TargetEnvironment = ({ label, isRequired, ...props }) => {
|
|||
}
|
||||
onClick={() => handleSetEnvironment('azure', !environment.azure)}
|
||||
onKeyDown={(e) => handleKeyDown(e, 'azure', !environment.azure)}
|
||||
onMouseEnter={() => prefetchSources('azure')}
|
||||
onMouseEnter={() => prefetchSources({ provider: 'azure' })}
|
||||
isSelected={environment.azure}
|
||||
isStacked
|
||||
isDisplayLarge
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { useSelector } from 'react-redux';
|
|||
|
||||
import ClonesTable from './ClonesTable';
|
||||
|
||||
import { useGetSourcesQuery } from '../../store/apiSlice';
|
||||
import { useGetSourceListQuery } from '../../store/provisioningApi';
|
||||
|
||||
const sourceNotFoundPopover = () => {
|
||||
return (
|
||||
|
|
@ -59,7 +59,9 @@ const sourceNotFoundPopover = () => {
|
|||
};
|
||||
|
||||
const getAzureSourceName = (id) => {
|
||||
const { data: sources, isSuccess } = useGetSourcesQuery('azure');
|
||||
const { data: sources, isSuccess } = useGetSourceListQuery({
|
||||
provider: 'azure',
|
||||
});
|
||||
|
||||
if (isSuccess) {
|
||||
const sourcename = sources.find((source) => source.id === id);
|
||||
|
|
@ -74,7 +76,9 @@ const getAzureSourceName = (id) => {
|
|||
};
|
||||
|
||||
const getAWSSourceName = (id) => {
|
||||
const { data: sources, isSuccess } = useGetSourcesQuery('aws');
|
||||
const { data: sources, isSuccess } = useGetSourceListQuery({
|
||||
provider: 'aws',
|
||||
});
|
||||
|
||||
if (isSuccess) {
|
||||
const sourcename = sources.find((source) => source.id === id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue