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 May 6, 2024
2 parents 83961cd + 716a2ae commit d1c7637
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 222 deletions.
303 changes: 133 additions & 170 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dependencies": {
"@ant-design/icons": "^5.3.6",
"@axa-fr/react-oidc": "^7.22.4",
"@tanstack/react-query": "^5.32.0",
"antd": "^5.16.4",
"@tanstack/react-query": "^5.32.1",
"antd": "^5.17.0",
"echarts": "5.5.0",
"echarts-for-react": "^3.0.2",
"rc-field-form": "^2.0.0",
Expand All @@ -17,7 +17,7 @@
"react-dom": "^18.3.1",
"react-router-dom": "^6.23.0",
"react-timer-hook": "^3.0.7",
"yaml": "^2.4.1",
"yaml": "^2.4.2",
"zustand": "^4.5.2"
},
"scripts": {
Expand Down Expand Up @@ -85,16 +85,16 @@
"devDependencies": {
"@axa-fr/oidc-client": "^7.22.4",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@tanstack/eslint-plugin-query": "^5.28.11",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^15.0.5",
"@tanstack/eslint-plugin-query": "^5.32.1",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.6",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.7",
"@types/react": "^18.2.79",
"@types/node": "^20.12.8",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"env-cmd": "^10.1.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0",
Expand All @@ -106,7 +106,7 @@
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"knip": "^5.11.0",
"knip": "^5.12.1",
"openapi-typescript-codegen": "^0.29.0",
"prettier": "3.2.5",
"react-scripts": "5.0.1",
Expand Down
28 changes: 16 additions & 12 deletions src/components/content/deployedServices/myServices/MyServices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ function MyServices(): React.JSX.Element {

if (listDeployedServicesQuery.isSuccess && listDeployedServicesQuery.data.length > 0) {
if (serviceDeploymentStateInQuery) {
serviceVoList = listDeployedServicesQuery.data.filter(
(serviceVo) => serviceVo.serviceDeploymentState === serviceDeploymentStateInQuery
serviceVoList = listDeployedServicesQuery.data.filter((serviceVo) =>
serviceDeploymentStateInQuery.includes(serviceVo.serviceDeploymentState)
);
} else if (serviceIdInQuery) {
serviceVoList = listDeployedServicesQuery.data.filter((serviceVo) => serviceVo.id === serviceIdInQuery);
Expand Down Expand Up @@ -941,16 +941,20 @@ function MyServices(): React.JSX.Element {
setIsScaleModalOpen(false);
};

function getServiceDeploymentStateFromQuery(): DeployedService.serviceDeploymentState | undefined {
const queryInUri = decodeURI(urlParams.get(serviceStateQuery) ?? '');
if (queryInUri.length > 0) {
if (
Object.values(DeployedService.serviceDeploymentState).includes(
queryInUri as DeployedService.serviceDeploymentState
)
) {
return queryInUri as DeployedService.serviceDeploymentState;
}
function getServiceDeploymentStateFromQuery(): DeployedService.serviceDeploymentState[] | undefined {
const serviceStateList: DeployedService.serviceDeploymentState[] = [];
if (urlParams.size > 0) {
urlParams.forEach((value, key, parent) => {
if (
key === serviceStateQuery &&
Object.values(DeployedService.serviceDeploymentState).includes(
value as DeployedService.serviceDeploymentState
)
) {
serviceStateList.push(value as DeployedService.serviceDeploymentState);
}
});
return serviceStateList;
}
return undefined;
}
Expand Down
28 changes: 16 additions & 12 deletions src/components/content/deployedServices/reports/Reports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function Reports(): React.JSX.Element {
const serviceList: DeployedService[] = [];
if (listDeployedServicesByIsvQuery.data.length > 0) {
if (serviceStateInQuery) {
deployedServiceList = listDeployedServicesByIsvQuery.data.filter(
(service) => service.serviceDeploymentState === serviceStateInQuery
deployedServiceList = listDeployedServicesByIsvQuery.data.filter((service) =>
serviceStateInQuery.includes(service.serviceDeploymentState)
);
} else if (serviceIdInQuery) {
deployedServiceList = listDeployedServicesByIsvQuery.data.filter(
Expand Down Expand Up @@ -344,16 +344,20 @@ function Reports(): React.JSX.Element {
setIsMyServiceDetailsModalOpen(false);
};

function getServiceStateFromQuery(): DeployedService.serviceDeploymentState | undefined {
const queryInUri = decodeURI(urlParams.get(serviceStateQuery) ?? '');
if (queryInUri.length > 0) {
if (
Object.values(DeployedService.serviceDeploymentState).includes(
queryInUri as DeployedService.serviceDeploymentState
)
) {
return queryInUri as DeployedService.serviceDeploymentState;
}
function getServiceStateFromQuery(): DeployedService.serviceDeploymentState[] | undefined {
const serviceStateList: DeployedService.serviceDeploymentState[] = [];
if (urlParams.size > 0) {
urlParams.forEach((value, key, parent) => {
if (
key === serviceStateQuery &&
Object.values(DeployedService.serviceDeploymentState).includes(
value as DeployedService.serviceDeploymentState
)
) {
serviceStateList.push(value as DeployedService.serviceDeploymentState);
}
});
return serviceStateList;
}
return undefined;
}
Expand Down
28 changes: 20 additions & 8 deletions src/components/content/home/isv/IsvServicesDashBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ export function IsvServicesDashBoard(): React.JSX.Element {

if (listDeployedServicesByIsvQuery.data !== undefined && listDeployedServicesByIsvQuery.data.length > 0) {
listDeployedServicesByIsvQuery.data.forEach((serviceItem: DeployedService) => {
if (serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DEPLOYMENT_SUCCESSFUL) {
if (
serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DEPLOYMENT_SUCCESSFUL ||
serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.MODIFICATION_SUCCESSFUL
) {
successfulDeploymentsCount++;
}
if (serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DEPLOYMENT_FAILED) {
if (
serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DEPLOYMENT_FAILED ||
serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.MODIFICATION_FAILED
) {
failedDeploymentsCount++;
}
if (serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DESTROY_SUCCESSFUL) {
Expand Down Expand Up @@ -73,11 +79,11 @@ export function IsvServicesDashBoard(): React.JSX.Element {
});
};

const getReportsRedirectionUrl = (serviceState: DeployedService.serviceDeploymentState) => {
const getReportsRedirectionUrl = (serviceState: DeployedService.serviceDeploymentState[]) => {
navigate({
pathname: reportsRoute,
search: createSearchParams({
serviceState: serviceState.valueOf(),
serviceState: serviceState,
}).toString(),
});
};
Expand Down Expand Up @@ -107,7 +113,10 @@ export function IsvServicesDashBoard(): React.JSX.Element {
<Col span={12} className={'dashboard-container-class'}>
<div
onClick={() => {
getReportsRedirectionUrl(DeployedService.serviceDeploymentState.DEPLOYMENT_SUCCESSFUL);
getReportsRedirectionUrl([
DeployedService.serviceDeploymentState.DEPLOYMENT_SUCCESSFUL,
DeployedService.serviceDeploymentState.MODIFICATION_SUCCESSFUL,
]);
}}
>
<Statistic
Expand All @@ -122,7 +131,10 @@ export function IsvServicesDashBoard(): React.JSX.Element {
<Col span={12} className={'dashboard-container-class'}>
<div
onClick={() => {
getReportsRedirectionUrl(DeployedService.serviceDeploymentState.DEPLOYMENT_FAILED);
getReportsRedirectionUrl([
DeployedService.serviceDeploymentState.DEPLOYMENT_FAILED,
DeployedService.serviceDeploymentState.MODIFICATION_FAILED,
]);
}}
>
<Statistic
Expand All @@ -137,7 +149,7 @@ export function IsvServicesDashBoard(): React.JSX.Element {
<Col span={12} className={'dashboard-container-class'}>
<div
onClick={() => {
getReportsRedirectionUrl(DeployedService.serviceDeploymentState.DESTROY_SUCCESSFUL);
getReportsRedirectionUrl([DeployedService.serviceDeploymentState.DESTROY_SUCCESSFUL]);
}}
>
<Statistic
Expand All @@ -152,7 +164,7 @@ export function IsvServicesDashBoard(): React.JSX.Element {
<Col span={12} className={'dashboard-container-class'}>
<div
onClick={() => {
getReportsRedirectionUrl(DeployedService.serviceDeploymentState.DESTROY_FAILED);
getReportsRedirectionUrl([DeployedService.serviceDeploymentState.DESTROY_FAILED]);
}}
>
<Statistic
Expand Down
30 changes: 21 additions & 9 deletions src/components/content/home/user/EndUserServicesDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import useListDeployedServicesQuery from '../../deployedServices/myServices/quer
import { myServicesRoute } from '../../../utils/constants';
import { DeployedService } from '../../../../xpanse-api/generated';
import { createSearchParams, useNavigate } from 'react-router-dom';
import serviceDeploymentState = DeployedService.serviceDeploymentState;
import DashBoardError from '../common/DashBoardError';
import { DashBoardSkeleton } from '../common/DashBoardSkeleton';
import serviceDeploymentState = DeployedService.serviceDeploymentState;

export function EndUserServicesDashboard(): React.JSX.Element {
const listDeployedServicesQuery = useListDeployedServicesQuery();
Expand All @@ -31,10 +31,16 @@ export function EndUserServicesDashboard(): React.JSX.Element {

if (listDeployedServicesQuery.data.length > 0) {
listDeployedServicesQuery.data.forEach((serviceItem: DeployedService) => {
if (serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DEPLOYMENT_SUCCESSFUL) {
if (
serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DEPLOYMENT_SUCCESSFUL ||
serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.MODIFICATION_SUCCESSFUL
) {
successfulDeploymentsCount++;
}
if (serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DEPLOYMENT_FAILED) {
if (
serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DEPLOYMENT_FAILED ||
serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.MODIFICATION_FAILED
) {
failedDeploymentsCount++;
}
if (serviceItem.serviceDeploymentState === DeployedService.serviceDeploymentState.DESTROY_SUCCESSFUL) {
Expand All @@ -46,11 +52,11 @@ export function EndUserServicesDashboard(): React.JSX.Element {
});
}

const getMyServicesRedirectionUrl = (serviceState: DeployedService.serviceDeploymentState) => {
const getMyServicesRedirectionUrl = (serviceState: DeployedService.serviceDeploymentState[]) => {
navigate({
pathname: myServicesRoute,
search: createSearchParams({
serviceState: serviceState.valueOf(),
serviceState: serviceState,
}).toString(),
});
};
Expand All @@ -62,7 +68,10 @@ export function EndUserServicesDashboard(): React.JSX.Element {
<Col span={12} className={'dashboard-container-class'}>
<div
onClick={() => {
getMyServicesRedirectionUrl(serviceDeploymentState.DEPLOYMENT_SUCCESSFUL);
getMyServicesRedirectionUrl([
serviceDeploymentState.DEPLOYMENT_SUCCESSFUL,
serviceDeploymentState.MODIFICATION_SUCCESSFUL,
]);
}}
>
<Statistic
Expand All @@ -77,7 +86,10 @@ export function EndUserServicesDashboard(): React.JSX.Element {
<Col span={12} className={'dashboard-container-class'}>
<div
onClick={() => {
getMyServicesRedirectionUrl(serviceDeploymentState.DEPLOYMENT_FAILED);
getMyServicesRedirectionUrl([
serviceDeploymentState.DEPLOYMENT_FAILED,
serviceDeploymentState.MODIFICATION_FAILED,
]);
}}
>
<Statistic
Expand All @@ -92,7 +104,7 @@ export function EndUserServicesDashboard(): React.JSX.Element {
<Col span={12} className={'dashboard-container-class'}>
<div
onClick={() => {
getMyServicesRedirectionUrl(serviceDeploymentState.DESTROY_SUCCESSFUL);
getMyServicesRedirectionUrl([serviceDeploymentState.DESTROY_SUCCESSFUL]);
}}
>
<Statistic
Expand All @@ -107,7 +119,7 @@ export function EndUserServicesDashboard(): React.JSX.Element {
<Col span={12} className={'dashboard-container-class'}>
<div
onClick={() => {
getMyServicesRedirectionUrl(serviceDeploymentState.DESTROY_FAILED);
getMyServicesRedirectionUrl([serviceDeploymentState.DESTROY_FAILED]);
}}
>
<Statistic
Expand Down

0 comments on commit d1c7637

Please sign in to comment.