forked from eclipse-xpanse/xpanse-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'eclipse-xpanse:main' into main
- Loading branch information
Showing
35 changed files
with
1,378 additions
and
823 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
156 changes: 156 additions & 0 deletions
156
src/components/content/deployedServices/myServices/MyServiceHistory.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> {value.customerServiceName} | ||
</li> | ||
{value.serviceRequestProperties ? ( | ||
<li> | ||
<Text strong>Service Request Properties:</Text> | ||
{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> {value.customerServiceName} | ||
</li> | ||
{value.serviceRequestProperties ? ( | ||
<li> | ||
<Text strong>Service Request Properties:</Text> | ||
{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> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/components/content/deployedServices/myServices/query/useListServiceModifyHistoryQuery.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.