Skip to content

Commit a904d25

Browse files
committed
fix undeploy ui crash
Signed-off-by: mermerlin320 <mrmerlin320@gmail.com>
1 parent 3621bc9 commit a904d25

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ui/components/DesignLifeCycle/DeploymentSummary.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@ import { Box, Stack, Typography, styled, useTheme } from '@layer5/sistent';
33

44
import { FormatStructuredData, TextWithLinks } from '../DataFormatter';
55
import { SEVERITY_STYLE } from '../NotificationCenter/constants';
6-
import { ErrorMetadataFormatter } from '../NotificationCenter/metadata';
76
import { ComponentIcon } from './common';
87
import { Button } from '@layer5/sistent';
98
import { ExternalLinkIcon, componentIcon } from '@layer5/sistent';
9+
import { ErrorMetadataFormatter } from '../NotificationCenter/formatters/error';
1010

1111
import { openViewScopedToDesignInOperator, useIsOperatorEnabled } from '@/utils/utils';
1212
import { useRouter } from 'next/router';
13+
import { capitalize } from 'lodash';
1314

1415
const StyledDetailBox = styled(Box)(() => ({
1516
display: 'flex',
1617
}));
1718

18-
const DeployementComponentFormatter = ({ componentDetail }) => {
19+
// deployment_type is deploy/undeploy
20+
const DeploymentComponentFormatter = ({ componentDetail, deploymentType }) => {
1921
return (
2022
<StyledDetailBox
2123
severityColor={
@@ -37,8 +39,8 @@ const DeployementComponentFormatter = ({ componentDetail }) => {
3739
/>
3840
<Typography variant="textB1Regular">
3941
{componentDetail.Success
40-
? `Deployed ${componentDetail.Kind} "${componentDetail.CompName}"`
41-
: `Failed to deploy ${componentDetail.Kind} "${componentDetail.CompName}"`}
42+
? `${capitalize(deploymentType)}ed ${componentDetail.Kind} "${componentDetail.CompName}"`
43+
: `Failed to ${deploymentType} ${componentDetail.Kind} "${componentDetail.CompName}"`}
4244
</Typography>
4345
</Stack>
4446
{componentDetail.Error && <ErrorMetadataFormatter metadata={componentDetail.Error} />}
@@ -66,6 +68,7 @@ const DeploymentSummaryFormatter_ = ({ event }) => {
6668

6769
const is_operator_enabled = useIsOperatorEnabled();
6870

71+
6972
return (
7073
<Box>
7174
<StyledDetailBox
@@ -106,8 +109,9 @@ const DeploymentSummaryFormatter_ = ({ event }) => {
106109
)}
107110

108111
{componentsDetails.map((componentDetail) => (
109-
<DeployementComponentFormatter
112+
<DeploymentComponentFormatter
110113
componentDetail={componentDetail}
114+
deploymentType={event.action}
111115
key={componentDetail.CompName + componentDetail.Location}
112116
/>
113117
))}

0 commit comments

Comments
 (0)