+ {convertMapToDetailsList(endPointMap, 'Endpoint Information')}
+
+ >
+ );
+ } else {
+ return
- {convertMapToDetailsList(endPointMap, 'Endpoint Information')}
+
+
{'Migration Failed.'}
+
+ {destroyedResponse.serviceHostingType === serviceHostingType.SELF.toString()
+ ? (destroyedResponse as DeployedServiceDetails).resultMessage
+ ? (destroyedResponse as DeployedServiceDetails).resultMessage
+ : (destroyedResponse as DeployedServiceDetails).resultMessage
+ : 'Migrate status polling failed. Please visit MyServices page to check ' +
+ 'the status of the request and contact service vendor for error details.'}
- >
+
);
- } else {
- return
{'Migration Successful'};
}
- } else if (response.serviceDeploymentState === serviceDeploymentState.DEPLOYMENT_FAILED) {
+ } else if (
+ deployedResponse &&
+ deployedResponse.serviceDeploymentState === serviceDeploymentState.DEPLOYMENT_FAILED
+ ) {
return (
{'Migration Failed.'}
- {currentServiceHostingType === serviceHostingType.SELF.toString()
- ? (response as DeployedServiceDetails).resultMessage
+ {deployedResponse.serviceHostingType === serviceHostingType.SELF.toString()
+ ? (deployedResponse as DeployedServiceDetails).resultMessage
+ ? (deployedResponse as DeployedServiceDetails).resultMessage
+ : (deployedResponse as DeployedServiceDetails).resultMessage
: 'Migrate status polling failed. Please visit MyServices page to check ' +
'the status of the request and contact service vendor for error details.'}
);
}
+
return <>>;
}
diff --git a/src/components/content/order/migrate/useMigrateServiceQuery.ts b/src/components/content/order/migrate/useMigrateServiceQuery.ts
index 72a0142a..064fc817 100644
--- a/src/components/content/order/migrate/useMigrateServiceQuery.ts
+++ b/src/components/content/order/migrate/useMigrateServiceQuery.ts
@@ -5,21 +5,18 @@
import { useMutation, useQuery } from '@tanstack/react-query';
import {
- GetMigrationOrderDetailsByIdData,
+ getSelfHostedServiceDetailsById,
GetSelfHostedServiceDetailsByIdData,
+ getVendorHostedServiceDetailsById,
GetVendorHostedServiceDetailsByIdData,
+ migrate,
MigrateData,
MigrateRequest,
- getMigrationOrderDetailsById,
- getSelfHostedServiceDetailsById,
- getVendorHostedServiceDetailsById,
- migrate,
- migrationStatus,
serviceHostingType,
+ taskStatus,
} from '../../../../xpanse-api/generated';
-import { deploymentStatusPollingInterval } from '../../../utils/constants';
-export function useMigrateServiceQuery() {
+export function useMigrateServiceRequest() {
return useMutation({
mutationFn: (migrateRequest: MigrateRequest) => {
const data: MigrateData = {
@@ -30,33 +27,10 @@ export function useMigrateServiceQuery() {
});
}
-export function useMigrateServiceDetailsPollingQuery(
- migrationId: string | undefined,
- isStartPolling: boolean,
- refetchUntilStates: migrationStatus[]
-) {
- return useQuery({
- queryKey: ['getServiceDetailsById', migrationId],
- queryFn: () => {
- const data: GetMigrationOrderDetailsByIdData = {
- migrationId: migrationId ?? '',
- };
- return getMigrationOrderDetailsById(data);
- },
- refetchInterval: (query) =>
- query.state.data && refetchUntilStates.includes(query.state.data.migrationStatus as migrationStatus)
- ? false
- : deploymentStatusPollingInterval,
- refetchIntervalInBackground: true,
- refetchOnWindowFocus: false,
- enabled: migrationId !== undefined && isStartPolling,
- });
-}
-
-export function useServiceDetailsPollingQuery(
+export function useServiceDetailsByServiceIdQuery(
serviceId: string | undefined,
currentServiceHostingType: string,
- currentMigrationStatus: string | undefined
+ currentMigrationTaskStatus: string | undefined
) {
return useQuery({
queryKey: ['getServiceDetailsById', serviceId, currentServiceHostingType],
@@ -75,9 +49,7 @@ export function useServiceDetailsPollingQuery(
},
enabled:
serviceId !== undefined &&
- (currentMigrationStatus === migrationStatus.MIGRATION_COMPLETED ||
- currentMigrationStatus === migrationStatus.DEPLOY_FAILED ||
- currentMigrationStatus === migrationStatus.DESTROY_FAILED),
+ (currentMigrationTaskStatus === taskStatus.SUCCESSFUL || currentMigrationTaskStatus === taskStatus.FAILED),
staleTime: Infinity,
gcTime: Infinity,
});
diff --git a/src/components/content/order/orderStatus/OrderSubmitResultDetails.tsx b/src/components/content/order/orderStatus/OrderSubmitResultDetails.tsx
index 74764742..3fb34a68 100644
--- a/src/components/content/order/orderStatus/OrderSubmitResultDetails.tsx
+++ b/src/components/content/order/orderStatus/OrderSubmitResultDetails.tsx
@@ -43,7 +43,9 @@ function OrderSubmitResultDetails({ msg, uuid }: { msg: string | React.JSX.Eleme
- {msg}
+