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 30, 2024
2 parents 52ae1ce + c429ca3 commit d120c1c
Show file tree
Hide file tree
Showing 35 changed files with 1,378 additions and 823 deletions.
389 changes: 242 additions & 147 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.12",
"@types/node": "^20.12.13",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^9.0.8",
Expand All @@ -119,20 +119,20 @@
"eslint-plugin-css-modules": "^2.12.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-require-explicit-generics": "^1.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"knip": "^5.17.2",
"knip": "^5.17.3",
"openapi-typescript-codegen": "^0.29.0",
"prettier": "3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"release-it": "^17.3.0",
"ts-jest": "^29.1.3",
"ts-jest": "^29.1.4",
"typescript": "5.4.5",
"uuid": "^9.0.1",
"vite": "^5.2.11"
"vite": "^5.2.12"
},
"overrides": {
"react-scripts": {
Expand Down
11 changes: 2 additions & 9 deletions src/components/content/catalog/services/tree/CategoryCatalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { TagOutlined } from '@ant-design/icons';
import { Alert, Empty, Skeleton, Tooltip, Typography } from 'antd';
import { Alert, Empty, Skeleton } from 'antd';
import { DataNode } from 'antd/es/tree';
import React from 'react';
import catalogStyles from '../../../../../styles/catalog.module.css';
Expand All @@ -20,7 +20,6 @@ import { CatalogFullView } from './CatalogFullView';

function CategoryCatalog({ category }: { category: ServiceTemplateDetailVo.category }): React.JSX.Element {
const treeData: DataNode[] = [];
const { Paragraph } = Typography;
let categoryOclData: Map<string, ServiceTemplateDetailVo[]> = new Map<string, ServiceTemplateDetailVo[]>();

const availableServiceTemplatesQuery = useAvailableServiceTemplatesQuery(category);
Expand All @@ -30,13 +29,7 @@ function CategoryCatalog({ category }: { category: ServiceTemplateDetailVo.categ
categoryOclData = groupServiceTemplatesByName(userAvailableServiceList);
categoryOclData.forEach((_value: ServiceTemplateDetailVo[], serviceName: string) => {
const dataNode: DataNode = {
title: (
<Tooltip placement='topLeft' title={serviceName}>
<Paragraph ellipsis={true} className={catalogStyles.catalogTreeNode}>
{serviceName}
</Paragraph>
</Tooltip>
),
title: <div className={catalogStyles.catalogTreeNode}>{serviceName}</div>,
key: serviceName || '',
children: [],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function UpdateResult({
type={'success'}
message={
<>
Service <b>{ocl.name}</b> Updated Successfully
Service <b>{ocl.name}</b> update request submitted successfully.
</>
}
closable={true}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: Huawei Inc.
*/

import { CheckCircleOutlined, MinusCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { Table, Tag, Tooltip, Typography } from 'antd';
import { ColumnsType } from 'antd/es/table';
import React from 'react';
import serviceModifyStyles from '../../../../styles/service-modify.module.css';
import {
DeployRequest,
DeployedServiceDetails,
ServiceModificationAuditDetails,
VendorHostedDeployedServiceDetails,
} from '../../../../xpanse-api/generated';
import useListServiceModifyHistoryQuery from './query/useListServiceModifyHistoryQuery';

const { Text } = Typography;

export const MyServiceHistory = ({
deployedService,
}: {
deployedService: DeployedServiceDetails | VendorHostedDeployedServiceDetails;
}): React.JSX.Element => {
let serviceModificationAuditHistoryList: ServiceModificationAuditDetails[] = [];
const listServiceModifyHistoryQuery = useListServiceModifyHistoryQuery(deployedService.id);

if (listServiceModifyHistoryQuery.isSuccess && listServiceModifyHistoryQuery.data.length > 0) {
serviceModificationAuditHistoryList = listServiceModifyHistoryQuery.data;
}

const columns: ColumnsType<ServiceModificationAuditDetails> = [
{
title: 'ModifyId',
dataIndex: 'id',
align: 'center',
width: 100,
className: serviceModifyStyles.modifyHistoryValue,
},
{
title: 'Previous',
dataIndex: 'previousDeployRequest',
width: 300,
className: serviceModifyStyles.modifyHistoryValue,
align: 'center',
render: (value: DeployRequest) => {
return (
<ul className={serviceModifyStyles.modifyHistoryValueLi}>
<li>
<Text strong>Customer Service Name:</Text>&nbsp;{value.customerServiceName}
</li>
{value.serviceRequestProperties ? (
<li>
<Text strong>Service Request Properties:</Text>&nbsp;
{JSON.stringify(value.serviceRequestProperties)}
</li>
) : (
<></>
)}
</ul>
);
},
},
{
title: 'New',
dataIndex: 'newDeployRequest',
className: serviceModifyStyles.modifyHistoryValue,
align: 'center',
width: 300,
render: (value: DeployRequest) => {
return (
<ul className={serviceModifyStyles.modifyHistoryValueLi}>
<li>
<Text strong>Customer Service Name:</Text>&nbsp;{value.customerServiceName}
</li>
{value.serviceRequestProperties ? (
<li>
<Text strong>Service Request Properties:</Text>&nbsp;
{JSON.stringify(value.serviceRequestProperties)}
</li>
) : (
<></>
)}
</ul>
);
},
},
{
title: 'StartedTime',
dataIndex: 'startedTime',
align: 'center',
width: 150,
},
{
title: 'CompletedTime',
dataIndex: 'completedTime',
align: 'center',
width: 150,
},
{
title: 'Status',
dataIndex: 'taskStatus',
align: 'center',
width: 50,
render: (value) => {
if (value === ServiceModificationAuditDetails.taskStatus.FAILED) {
return (
<Tag icon={<QuestionCircleOutlined />} color={'error'}>
{value}
</Tag>
);
} else if (value === ServiceModificationAuditDetails.taskStatus.SUCCESSFUL) {
return (
<Tag icon={<CheckCircleOutlined />} color={'success'}>
{value}
</Tag>
);
} else {
return (
<Tag icon={<MinusCircleOutlined />} color={'default'}>
{value}
</Tag>
);
}
},
},
{
title: 'Failure Reason',
dataIndex: 'errorMsg',
align: 'center',
width: 150,
render: (value: string | undefined) => {
if (value) {
return (
<Tooltip title={value}>
<span className={serviceModifyStyles.modifyHistoryErrorMsgValue}>{value}</span>
</Tooltip>
);
}
},
},
];

return (
<div className={serviceModifyStyles.modifyContainer}>
<Table
columns={columns}
dataSource={serviceModificationAuditHistoryList}
loading={listServiceModifyHistoryQuery.isPending || listServiceModifyHistoryQuery.isRefetching}
rowKey={'id'}
scroll={{ x: 'max-content' }}
/>
</div>
);
};
45 changes: 45 additions & 0 deletions src/components/content/deployedServices/myServices/MyServices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
DeleteOutlined,
EditOutlined,
FundOutlined,
HistoryOutlined,
InfoCircleOutlined,
LockOutlined,
PlayCircleOutlined,
Expand Down Expand Up @@ -62,6 +63,7 @@ import { DeployedServicesHostingType } from '../common/DeployedServicesHostingTy
import { DeployedServicesRunningStatus } from '../common/DeployedServicesRunningStatus';
import { DeployedServicesStatus } from '../common/DeployedServicesStatus';
import { MyServiceDetails } from './MyServiceDetails';
import { MyServiceHistory } from './MyServiceHistory';
import useGetOrderableServiceDetailsQuery from './query/useGetOrderableServiceDetailsQuery';
import useListDeployedServicesDetailsQuery from './query/useListDeployedServicesDetailsQuery';

Expand Down Expand Up @@ -90,6 +92,7 @@ function MyServices(): React.JSX.Element {
const [isDestroyRequestSubmitted, setIsDestroyRequestSubmitted] = useState<boolean>(false);
const [isPurgeRequestSubmitted, setIsPurgeRequestSubmitted] = useState<boolean>(false);
const [isMyServiceDetailsModalOpen, setIsMyServiceDetailsModalOpen] = useState(false);
const [isMyServiceHistoryModalOpen, setIsMyServiceHistoryModalOpen] = useState(false);
const [isMigrateModalOpen, setIsMigrateModalOpen] = useState<boolean>(false);
const [isModifyModalOpen, setIsModifyModalOpen] = useState<boolean>(false);
const [isScaleModalOpen, setIsScaleModalOpen] = useState<boolean>(false);
Expand Down Expand Up @@ -568,6 +571,23 @@ function MyServices(): React.JSX.Element {
</Button>
),
},
{
key: 'history',
label: record.latestModificationAudit ? (
<Button
onClick={() => {
handleMyServiceHistoryOpenModal(record);
}}
className={myServicesStyles.buttonAsLink}
icon={<HistoryOutlined />}
type={'link'}
>
history
</Button>
) : (
<></>
),
},
];
};

Expand Down Expand Up @@ -1153,6 +1173,20 @@ function MyServices(): React.JSX.Element {
setIsMyServiceDetailsModalOpen(false);
};

const handleMyServiceHistoryOpenModal = (record: DeployedService) => {
setActiveRecord(
record.serviceHostingType === DeployedService.serviceHostingType.SELF
? (record as DeployedServiceDetails)
: (record as VendorHostedDeployedServiceDetails)
);
setIsMyServiceHistoryModalOpen(true);
};

const handleMyServiceHistoryModalClose = () => {
setActiveRecord(undefined);
setIsMyServiceHistoryModalOpen(false);
};

const handleCancelMigrateModel = () => {
setActiveRecord(undefined);
clearFormVariables();
Expand Down Expand Up @@ -1282,6 +1316,17 @@ function MyServices(): React.JSX.Element {
<MyServiceDetails deployedService={activeRecord} />
</Modal>
) : null}
{activeRecord ? (
<Modal
title={'Service Modified History'}
width={1600}
footer={null}
open={isMyServiceHistoryModalOpen}
onCancel={handleMyServiceHistoryModalClose}
>
<MyServiceHistory deployedService={activeRecord} />
</Modal>
) : null}
{activeRecord ? (
<Modal
open={isMigrateModalOpen}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: Huawei Inc.
*/

import { useQuery } from '@tanstack/react-query';
import { ServiceModificationService } from '../../../../../xpanse-api/generated';

export default function useListServiceModifyHistoryQuery(serviceId: string) {
return useQuery({
queryKey: ['listDeployedServicesByIsv', serviceId],
queryFn: () => ServiceModificationService.listServiceModificationAudits(serviceId, undefined),
refetchOnWindowFocus: false,
});
}
21 changes: 0 additions & 21 deletions src/components/content/order/common/BillingInfo.tsx

This file was deleted.

Loading

0 comments on commit d120c1c

Please sign in to comment.