Skip to content

Commit c1962be

Browse files
committed
feat: update AnimatedDeployButton to use exceptionUserConfig for deployment approval logic
1 parent 7a8e491 commit c1962be

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/Shared/Components/AnimatedDeployButton/AnimatedDeployButton.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const AnimatedDeployButton = ({
3030
isLoading,
3131
isVirtualEnvironment,
3232
onButtonClick,
33-
canDeployWithoutApproval,
33+
exceptionUserConfig,
3434
isBulkCDTrigger,
3535
}: AnimatedDeployButtonProps) => {
3636
const audioRef = useRef<HTMLAudioElement>(null)
@@ -42,6 +42,7 @@ const AnimatedDeployButton = ({
4242
rotate: 45,
4343
},
4444
}
45+
const isExceptionUser = exceptionUserConfig?.canDeploy || exceptionUserConfig?.isImageApprover
4546

4647
const handleButtonClick = async (e: SyntheticEvent) => {
4748
if (clicked) {
@@ -74,7 +75,7 @@ const AnimatedDeployButton = ({
7475
dataTestId="cd-trigger-deploy-button"
7576
isLoading={isLoading}
7677
text={
77-
canDeployWithoutApproval
78+
exceptionUserConfig?.canDeploy
7879
? 'Deploy without approval'
7980
: `Deploy${isVirtualEnvironment ? ' to isolated env' : ''}`
8081
}
@@ -99,12 +100,12 @@ const AnimatedDeployButton = ({
99100
}
100101
size={ComponentSizeType.large}
101102
onClick={handleButtonClick}
102-
style={canDeployWithoutApproval && !isBulkCDTrigger ? ButtonStyleType.warning : ButtonStyleType.default}
103-
showTooltip={canDeployWithoutApproval}
103+
style={isExceptionUser && !isBulkCDTrigger ? ButtonStyleType.warning : ButtonStyleType.default}
104+
showTooltip={isExceptionUser}
104105
tooltipProps={{
105106
content: isBulkCDTrigger
106-
? 'Non-approved image(s) are selected for some applications. You are authorized to deploy.'
107-
: 'A non-approved image is selected. You are authorized to deploy.',
107+
? 'You are authorized to deploy as an exception user for some applications'
108+
: 'You are authorized to deploy as an exception user',
108109
}}
109110
/>
110111
{/* Disabling es-lint as captions are not required */}

src/Shared/Components/AnimatedDeployButton/types.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export interface AnimatedDeployButtonProps {
1818
isLoading?: boolean
1919
isVirtualEnvironment: boolean
2020
onButtonClick: (e, disableDeployButton: boolean) => void
21-
canDeployWithoutApproval?: boolean
21+
exceptionUserConfig?: {
22+
canDeploy: boolean
23+
isImageApprover: boolean
24+
}
2225
isBulkCDTrigger?: boolean
2326
}

0 commit comments

Comments
 (0)