Skip to content

Commit

Permalink
Merge branch 'eclipse-xpanse:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
WangLiNaruto authored Aug 6, 2024
2 parents 3837ce5 + c530b39 commit 18ebeb3
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 148 deletions.
257 changes: 127 additions & 130 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@ant-design/icons": "^5.4.0",
"@axa-fr/react-oidc": "^7.22.21",
"@hey-api/openapi-ts": "^0.51.0",
"@hey-api/openapi-ts": "^0.52.0",
"@tanstack/react-query": "^5.51.21",
"antd": "^5.20.0",
"echarts": "5.5.1",
Expand All @@ -16,7 +16,7 @@
"rc-tabs": "^15.1.1",
"react": "^18.2.0",
"react-dom": "^18.3.1",
"react-router-dom": "^6.25.1",
"react-router-dom": "^6.26.0",
"react-timer-hook": "^3.0.7",
"yaml": "^2.5.0",
"zustand": "^4.5.4"
Expand Down Expand Up @@ -110,8 +110,8 @@
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.0",
"@vitejs/plugin-react": "^4.3.1",
"env-cmd": "^10.1.0",
"eslint": "^8.57.0",
Expand All @@ -129,7 +129,7 @@
"prettier": "3.3.3",
"prettier-plugin-organize-imports": "^4.0.0",
"release-it": "^17.6.0",
"ts-jest": "^29.2.3",
"ts-jest": "^29.2.4",
"typescript": "5.5.4",
"uuid": "^10.0.0",
"vite": "^5.3.5"
Expand All @@ -139,7 +139,7 @@
"typescript": "^5"
},
"eslint-config-react-app": {
"@typescript-eslint/eslint-plugin": "^7.0.1"
"@typescript-eslint/eslint-plugin": "^8.0.0"
}
},
"knip": {
Expand Down
18 changes: 17 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
homePageRoute,
monitorPageRoute,
myServicesRoute,
numberOfRetries,
orderPageRoute,
policiesRoute,
registerFailedRoute,
Expand All @@ -32,8 +33,23 @@ import {
workflowsPageRoute,
} from './components/utils/constants';
import './styles/app.module.css';
import { ApiError } from './xpanse-api/generated';

const queryClient = new QueryClient();
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: (failureCount: number, error: Error) => {
if (error instanceof ApiError) {
if (error.status >= 400 && error.status <= 499) {
return false;
}
}
return failureCount < numberOfRetries;
},
},
},
});

const Home = lazy(() => import('./components/content/home/Home.tsx'));
const RegisterPanel = lazy(() => import('./components/content/register/RegisterPanel.tsx'));
Expand Down
1 change: 1 addition & 0 deletions src/components/content/order/create/OrderSubmit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function OrderSubmit(state: OrderSubmitProps): React.JSX.Element {
key={uniqueRequestId.current}
uuid={submitDeploymentRequest.data?.serviceId ?? ''}
isSubmitFailed={submitDeploymentRequest.error}
serviceHostType={state.serviceHostingType}
deployedServiceDetails={getServiceDetailsByIdQuery.data}
isPollingError={getServiceDetailsByIdQuery.isError}
serviceProviderContactDetails={state.contactServiceDetails}
Expand Down
1 change: 0 additions & 1 deletion src/components/content/order/migrate/Migrate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ export const Migrate = ({
deployParams={deployParams}
currentSelectedService={currentSelectedService}
stepItem={items[MigrationSteps.MigrateService]}
onChangeFlavor={onChangeFlavor}
getServicePriceQuery={getServicePriceQuery}
/>
);
Expand Down
3 changes: 0 additions & 3 deletions src/components/content/order/migrate/MigrateServiceSubmit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const MigrateServiceSubmit = ({
deployParams,
currentSelectedService,
stepItem,
onChangeFlavor,
getServicePriceQuery,
}: {
userOrderableServiceVoList: UserOrderableServiceVo[];
Expand All @@ -66,7 +65,6 @@ export const MigrateServiceSubmit = ({
deployParams: DeployRequest | undefined;
currentSelectedService: DeployedService;
stepItem: StepProps;
onChangeFlavor: (newFlavor: string) => void;
getServicePriceQuery: UseQueryResult<ServiceFlavorWithPriceResult[]>;
}): React.JSX.Element => {
const [isShowDeploymentResult, setIsShowDeploymentResult] = useState<boolean>(false);
Expand Down Expand Up @@ -186,7 +184,6 @@ export const MigrateServiceSubmit = ({
<FlavorSelection
selectFlavor={selectFlavor}
flavorList={currentFlavorList}
onChangeFlavor={onChangeFlavor}
getServicePriceQuery={getServicePriceQuery}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export function MigrationProcessingStatus({
<div>
{currentServiceHostingType === serviceHostingType.SELF.toString()
? (response as DeployedServiceDetails).resultMessage
: 'Migrate status polling failed. Please visit MyServices page to check the status of the request.'}
: 'Migrate status polling failed. Please visit MyServices page to check ' +
'the status of the request and contact service vendor for error details.'}
</div>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/content/order/migrate/SelectDestination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ export const SelectDestination = ({
/>
<FlavorSelection
selectFlavor={selectFlavor}
setSelectFlavor={setSelectFlavor}
flavorList={flavorList}
onChangeFlavor={onChangeFlavor}
getServicePriceQuery={getServicePriceQuery}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
DeployedServiceDetails,
Response,
serviceDeploymentState,
serviceHostingType,
ServiceProviderContactDetails,
} from '../../../../xpanse-api/generated';
import { convertStringArrayToUnorderedList } from '../../../utils/generateUnorderedList';
Expand All @@ -20,12 +21,14 @@ import { ProcessingStatus } from './ProcessingStatus';
function OrderSubmitStatusAlert({
uuid,
isSubmitFailed,
serviceHostType,
deployedServiceDetails,
serviceProviderContactDetails,
isPollingError,
}: {
uuid: string | undefined;
isSubmitFailed: Error | null;
serviceHostType: serviceHostingType;
deployedServiceDetails: DeployedServiceDetails | undefined;
serviceProviderContactDetails: ServiceProviderContactDetails | undefined;
isPollingError: boolean;
Expand Down Expand Up @@ -63,14 +66,18 @@ function OrderSubmitStatusAlert({
return getOrderSubmissionFailedDisplay([isSubmitFailed.message]);
}
} else if (uuid && isPollingError) {
return 'Deployment status polling failed. Please visit MyServices page to check the status of the request.';
if (serviceHostType === serviceHostingType.SERVICE_VENDOR) {
return 'Deployment status polling failed. Please visit MyServices page to check the status of the request and contact service vendor for error details.';
} else {
return 'Deployment status polling failed. Please visit MyServices page to check the status of the request';
}
} else if (uuid) {
return 'Request accepted';
} else if (uuid === undefined) {
return 'Request submission in-progress';
}
return '';
}, [deployedServiceDetails, uuid, isPollingError, isSubmitFailed]);
}, [deployedServiceDetails, uuid, isPollingError, isSubmitFailed, serviceHostType]);

const alertType = useMemo(() => {
if (isPollingError || isSubmitFailed) {
Expand Down
15 changes: 11 additions & 4 deletions src/components/content/order/orderStatus/ProcessingStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import React from 'react';
import submitResultStyles from '../../../../styles/submit-result.module.css';
import { DeployedServiceDetails, serviceDeploymentState } from '../../../../xpanse-api/generated';
import { DeployedServiceDetails, serviceDeploymentState, serviceHostingType } from '../../../../xpanse-api/generated';
import { convertMapToDetailsList } from '../../../utils/convertMapToDetailsList';
import { OperationType } from '../types/OperationType';

Expand All @@ -16,6 +16,7 @@ export const ProcessingStatus = ({
response: DeployedServiceDetails;
operationType: OperationType;
}): React.JSX.Element => {
const errorMsg: string = 'Please contact service vendor for error details.';
const endPointMap = new Map<string, string>();
if (operationType === (OperationType.Deploy as OperationType)) {
if (response.serviceDeploymentState === serviceDeploymentState.DEPLOYMENT_SUCCESSFUL) {
Expand All @@ -40,7 +41,9 @@ export const ProcessingStatus = ({
return (
<div>
<span>{'Deployment Failed.'}</span>
<div>{response.resultMessage}</div>
<div>
{response.serviceHostingType === serviceHostingType.SELF ? response.resultMessage : errorMsg}
</div>
</div>
);
}
Expand Down Expand Up @@ -69,7 +72,9 @@ export const ProcessingStatus = ({
return (
<div>
<span>{'Modification Failed.'}</span>
<div>{response.resultMessage}</div>
<div>
{response.serviceHostingType === serviceHostingType.SELF ? response.resultMessage : errorMsg}
</div>
</div>
);
}
Expand All @@ -86,7 +91,9 @@ export const ProcessingStatus = ({
return (
<div>
<span>{'Destroyed Failed.'}</span>
<div>{response.resultMessage}</div>
<div>
{response.serviceHostingType === serviceHostingType.SELF ? response.resultMessage : errorMsg}
</div>
</div>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/utils/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ export const serviceReviewsPageRoute: string = '/reviewService';
export const serviceReviewsLabelName: string = 'Review Service';
export const registeredServicesPageRoute: string = '/registeredServices';
export const registeredServicesLabelName: string = 'Registered Services';

export const numberOfRetries: number = 2; // this will retry 3 times. Count starts from 0.

0 comments on commit 18ebeb3

Please sign in to comment.