Skip to content

Commit 6824130

Browse files
authored
display order id. (#1553)
1 parent 65e0b89 commit 6824130

19 files changed

+614
-430
lines changed

src/components/content/order/common/ScaleOrModifyOrderSubmitResult.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ import OrderSubmitResultDetails from '../orderStatus/OrderSubmitResultDetails';
1515

1616
export const ScaleOrModifyOrderSubmitResult = ({
1717
msg,
18-
uuid,
18+
serviceId,
19+
orderId,
1920
type,
2021
stopWatch,
2122
contactServiceDetails,
2223
}: {
2324
msg: string | React.JSX.Element;
24-
uuid: string;
25+
serviceId: string;
26+
orderId: string;
2527
type: 'success' | 'error';
2628
stopWatch: StopwatchResult;
2729
contactServiceDetails: ServiceProviderContactDetails | undefined;
@@ -31,7 +33,7 @@ export const ScaleOrModifyOrderSubmitResult = ({
3133
{' '}
3234
<Alert
3335
message={`Processing Status`}
34-
description={<OrderSubmitResultDetails msg={msg} serviceId={uuid} />}
36+
description={<OrderSubmitResultDetails msg={msg} serviceId={serviceId} orderId={orderId} />}
3537
showIcon
3638
closable={true}
3739
type={type}

src/components/content/order/common/ScaleOrModifySubmitStatusAlert.tsx

+16-1
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,25 @@ function ScaleOrModifySubmitStatusAlert({
146146
);
147147
}
148148

149+
const getOrderId = (): string => {
150+
if (modifyServiceRequest.isSuccess) {
151+
return modifyServiceRequest.data.orderId;
152+
} else {
153+
if (
154+
isHandleKnownErrorResponse(modifyServiceRequest.error) &&
155+
'orderId' in modifyServiceRequest.error.body
156+
) {
157+
return modifyServiceRequest.error.body.orderId as string;
158+
}
159+
return '-';
160+
}
161+
};
162+
149163
return (
150164
<ScaleOrModifyOrderSubmitResult
151165
msg={msg ?? ''}
152-
uuid={currentSelectedService.serviceId}
166+
serviceId={currentSelectedService.serviceId}
167+
orderId={getOrderId()}
153168
type={alertType}
154169
stopWatch={stopWatch}
155170
contactServiceDetails={alertType !== 'success' ? serviceProviderContactDetails : undefined}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* SPDX-FileCopyrightText: Huawei Inc.
4+
*/
5+
6+
import { Alert } from 'antd';
7+
import React from 'react';
8+
import submitAlertStyles from '../../../../styles/submit-alert.module.css';
9+
import { ServiceProviderContactDetails } from '../../../../xpanse-api/generated';
10+
import { ContactDetailsShowType } from '../../common/ocl/ContactDetailsShowType';
11+
import { ContactDetailsText } from '../../common/ocl/ContactDetailsText';
12+
import OrderSubmitResultDetails from '../orderStatus/OrderSubmitResultDetails';
13+
14+
export const ServiceStateSubmitResult = ({
15+
msg,
16+
serviceId,
17+
orderId,
18+
type,
19+
onClose,
20+
contactServiceDetails,
21+
}: {
22+
msg: string | React.JSX.Element;
23+
serviceId: string;
24+
orderId: string;
25+
type: 'success' | 'error';
26+
onClose: () => void;
27+
contactServiceDetails: ServiceProviderContactDetails | undefined;
28+
}): React.JSX.Element => {
29+
return (
30+
<div className={submitAlertStyles.submitAlertTip}>
31+
{' '}
32+
<Alert
33+
message={`Processing Status`}
34+
description={<OrderSubmitResultDetails msg={msg} serviceId={serviceId} orderId={orderId} />}
35+
showIcon
36+
closable={true}
37+
onClose={onClose}
38+
type={type}
39+
action={
40+
<>
41+
{contactServiceDetails !== undefined ? (
42+
<ContactDetailsText
43+
serviceProviderContactDetails={contactServiceDetails}
44+
showFor={ContactDetailsShowType.Order}
45+
/>
46+
) : (
47+
<></>
48+
)}
49+
</>
50+
}
51+
/>{' '}
52+
</div>
53+
);
54+
};

src/components/content/order/destroy/DestroyOrderSubmitResult.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ import OrderSubmitResultDetails from '../orderStatus/OrderSubmitResultDetails';
1515

1616
export const DestroyOrderSubmitResult = ({
1717
msg,
18-
uuid,
18+
serviceId,
19+
orderId,
1920
type,
2021
onClose,
2122
stopWatch,
2223
contactServiceDetails,
2324
}: {
2425
msg: string | React.JSX.Element;
25-
uuid: string;
26+
serviceId: string;
27+
orderId: string;
2628
type: 'success' | 'error';
2729
onClose: () => void;
2830
stopWatch: StopwatchResult;
@@ -33,7 +35,7 @@ export const DestroyOrderSubmitResult = ({
3335
{' '}
3436
<Alert
3537
message={`Processing Status`}
36-
description={<OrderSubmitResultDetails msg={msg} serviceId={uuid} />}
38+
description={<OrderSubmitResultDetails msg={msg} serviceId={serviceId} orderId={orderId} />}
3739
showIcon
3840
closable={true}
3941
onClose={onClose}

src/components/content/order/destroy/DestroyServiceStatusAlert.tsx

+16-1
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,25 @@ function DestroyServiceStatusAlert({
138138
);
139139
}
140140

141+
const getOrderId = (): string => {
142+
if (destroySubmitRequest.isSuccess) {
143+
return destroySubmitRequest.data.orderId;
144+
} else {
145+
if (
146+
isHandleKnownErrorResponse(destroySubmitRequest.error) &&
147+
'orderId' in destroySubmitRequest.error.body
148+
) {
149+
return destroySubmitRequest.error.body.orderId as string;
150+
}
151+
return '-';
152+
}
153+
};
154+
141155
return (
142156
<DestroyOrderSubmitResult
143157
msg={msg ?? ''}
144-
uuid={deployedService.serviceId}
158+
serviceId={deployedService.serviceId}
159+
orderId={getOrderId()}
145160
type={alertType}
146161
onClose={onClose}
147162
stopWatch={stopWatch}

src/components/content/order/orderStatus/OrderProcessingStatus.tsx

+63
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,68 @@ export const OrderProcessingStatus = ({
142142
);
143143
}
144144
}
145+
146+
if (operationType === OperationType.Restart) {
147+
if (serviceOrderStatus.orderStatus === 'successful') {
148+
return (
149+
<div>
150+
<span>{'Service restarted successfully.'}</span>
151+
</div>
152+
);
153+
} else if (serviceOrderStatus.orderStatus === 'failed') {
154+
return (
155+
<div>
156+
<span>{'Service restarted failed.'}</span>
157+
<div>
158+
{selectedServiceHostingType === serviceHostingType.SELF
159+
? serviceOrderStatus.error?.details.join()
160+
: errorMsg}
161+
</div>
162+
</div>
163+
);
164+
}
165+
}
166+
167+
if (operationType === OperationType.Start) {
168+
if (serviceOrderStatus.orderStatus === 'successful') {
169+
return (
170+
<div>
171+
<span>{'Service started successfully.'}</span>
172+
</div>
173+
);
174+
} else if (serviceOrderStatus.orderStatus === 'failed') {
175+
return (
176+
<div>
177+
<span>{'Service started failed.'}</span>
178+
<div>
179+
{selectedServiceHostingType === serviceHostingType.SELF
180+
? serviceOrderStatus.error?.details.join()
181+
: errorMsg}
182+
</div>
183+
</div>
184+
);
185+
}
186+
}
187+
188+
if (operationType === OperationType.Stop) {
189+
if (serviceOrderStatus.orderStatus === 'successful') {
190+
return (
191+
<div>
192+
<span>{'Service stopped successfully.'}</span>
193+
</div>
194+
);
195+
} else if (serviceOrderStatus.orderStatus === 'failed') {
196+
return (
197+
<div>
198+
<span>{'Service stopped failed.'}</span>
199+
<div>
200+
{selectedServiceHostingType === serviceHostingType.SELF
201+
? serviceOrderStatus.error?.details.join()
202+
: errorMsg}
203+
</div>
204+
</div>
205+
);
206+
}
207+
}
145208
return <></>;
146209
};

src/components/content/order/orderStatus/OrderSubmitResult.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import OrderSubmitResultDetails from './OrderSubmitResultDetails';
1616

1717
export const OrderSubmitResult = ({
1818
msg,
19-
uuid,
19+
serviceId,
20+
orderId,
2021
type,
2122
stopWatch,
2223
isDeployRequestError,
@@ -25,7 +26,8 @@ export const OrderSubmitResult = ({
2526
onClose,
2627
}: {
2728
msg: string | React.JSX.Element;
28-
uuid: string;
29+
serviceId: string;
30+
orderId: string;
2931
type: 'success' | 'error';
3032
stopWatch: StopwatchResult;
3133
isDeployRequestError: boolean;
@@ -38,7 +40,7 @@ export const OrderSubmitResult = ({
3840
{' '}
3941
<Alert
4042
message={`Processing Status`}
41-
description={<OrderSubmitResultDetails msg={msg} serviceId={uuid} />}
43+
description={<OrderSubmitResultDetails msg={msg} serviceId={serviceId} orderId={orderId} />}
4244
showIcon
4345
closable={true}
4446
onClose={onClose}

src/components/content/order/orderStatus/OrderSubmitResultDetails.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ import { myServicesRoute, orderPageRoute } from '../../../utils/constants';
1414
function OrderSubmitResultDetails({
1515
msg,
1616
serviceId,
17+
orderId,
1718
}: {
1819
msg: string | React.JSX.Element;
1920
serviceId: string;
21+
orderId: string;
2022
}): React.JSX.Element {
2123
const { Paragraph } = Typography;
2224
const navigate = useNavigate();
@@ -49,6 +51,21 @@ function OrderSubmitResultDetails({
4951
</span>
5052
</Paragraph>
5153
</div>
54+
<div className={submitResultStyles.resultContainer}>
55+
Order ID:&nbsp;
56+
<Paragraph
57+
className={submitResultStyles.resultMainDetails}
58+
copyable={{
59+
text: String(serviceId),
60+
icon: [
61+
<CopyOutlined className={submitResultStyles.showDetailsTypographyCopy} key={uuidv4()} />,
62+
<CheckOutlined className={submitResultStyles.showDetailsTypographyCopy} key={uuidv4()} />,
63+
],
64+
}}
65+
>
66+
<span className={submitResultStyles.showDetailsTypographyCopyInfo}>{orderId}</span>
67+
</Paragraph>
68+
</div>
5269
{msg}
5370
</div>
5471
);

src/components/content/order/orderStatus/OrderSubmitStatusAlert.tsx

+26-1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,30 @@ function OrderSubmitStatusAlert({
177177
}
178178
};
179179

180+
const getOrderId = (): string => {
181+
if (submitDeploymentRequest.isSuccess) {
182+
return submitDeploymentRequest.data.orderId;
183+
}
184+
if (redeployFailedDeploymentQuery.isSuccess) {
185+
return redeployFailedDeploymentQuery.data.orderId;
186+
}
187+
188+
if (
189+
isHandleKnownErrorResponse(redeployFailedDeploymentQuery.error) &&
190+
'orderId' in redeployFailedDeploymentQuery.error.body
191+
) {
192+
return redeployFailedDeploymentQuery.error.body.orderId as string;
193+
}
194+
195+
if (
196+
isHandleKnownErrorResponse(submitDeploymentRequest.error) &&
197+
'orderId' in submitDeploymentRequest.error.body
198+
) {
199+
return submitDeploymentRequest.error.body.orderId as string;
200+
}
201+
return '-';
202+
};
203+
180204
const isDeployDisabled = () => {
181205
if (
182206
isHandleKnownErrorResponse(submitDeploymentRequest.error) &&
@@ -200,7 +224,8 @@ function OrderSubmitStatusAlert({
200224
return (
201225
<OrderSubmitResult
202226
msg={msg ?? ''}
203-
uuid={getServiceId()}
227+
serviceId={getServiceId()}
228+
orderId={getOrderId()}
204229
type={alertType}
205230
stopWatch={stopWatch}
206231
isDeployRequestError={isDeployDisabled()}

src/components/content/order/purge/PurgeOrderSubmitResult.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ import OrderSubmitResultDetails from '../orderStatus/OrderSubmitResultDetails';
1313

1414
export const PurgeOrderSubmitResult = ({
1515
msg,
16-
uuid,
16+
serviceId,
17+
orderId,
1718
type,
1819
onClose,
1920
contactServiceDetails,
2021
}: {
2122
msg: string | React.JSX.Element;
22-
uuid: string;
23+
serviceId: string;
24+
orderId: string;
2325
type: 'success' | 'error';
2426
onClose: () => void;
2527
contactServiceDetails: ServiceProviderContactDetails | undefined;
@@ -29,7 +31,7 @@ export const PurgeOrderSubmitResult = ({
2931
{' '}
3032
<Alert
3133
message={`Processing Status`}
32-
description={<OrderSubmitResultDetails msg={msg} serviceId={uuid} />}
34+
description={<OrderSubmitResultDetails msg={msg} serviceId={serviceId} orderId={orderId} />}
3335
showIcon
3436
closable={true}
3537
onClose={onClose}

src/components/content/order/purge/PurgeServiceStatusAlert.tsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,22 @@ export function PurgeServiceStatusAlert({
9191
);
9292
}
9393

94+
const getOrderId = (): string => {
95+
if (purgeSubmitRequest.isSuccess) {
96+
return purgeSubmitRequest.data.orderId;
97+
} else {
98+
if (isHandleKnownErrorResponse(purgeSubmitRequest.error) && 'orderId' in purgeSubmitRequest.error.body) {
99+
return purgeSubmitRequest.error.body.orderId as string;
100+
}
101+
return '-';
102+
}
103+
};
104+
94105
return (
95106
<PurgeOrderSubmitResult
96107
msg={msg ?? ''}
97-
uuid={deployedService.serviceId}
108+
serviceId={deployedService.serviceId}
109+
orderId={getOrderId()}
98110
type={alertType}
99111
onClose={onClose}
100112
contactServiceDetails={alertType !== 'success' ? serviceProviderContactDetails : undefined}

0 commit comments

Comments
 (0)