Skip to content

Commit 2b5bae1

Browse files
committed
Merge branch 'develop' of https://github.com/devtron-labs/dashboard into feat/replace-conf-dialogs
2 parents 236e0dd + bc8106e commit 2b5bae1

File tree

8 files changed

+235
-275
lines changed

8 files changed

+235
-275
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ src/components/app/list/appList.modal.ts
127127
src/components/app/list/emptyView/Empty.tsx
128128
src/components/app/list/expandedRow/ExpandedRow.tsx
129129
src/components/app/service.ts
130-
src/components/app/types.ts
131130
src/components/bulkEdits/BulkEdits.tsx
132131
src/components/bulkEdits/bulkedit.utils.tsx
133132
src/components/cdPipeline/BuildCD.tsx

src/components/app/details/appDetails/AppDetails.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
getAppDetailsURL,
3333
getAppsInfoForEnv,
3434
getIsRequestAborted,
35+
Icon,
3536
MODAL_TYPE,
3637
noop,
3738
processDeploymentStatusDetailsData,
@@ -87,6 +88,7 @@ import {
8788
} from './appDetails.type'
8889
import AppDetailsCDButton from './AppDetailsCDButton'
8990
import { AppMetrics } from './AppMetrics'
91+
import { AG_APP_DETAILS_GA_EVENTS, DA_APP_DETAILS_GA_EVENTS } from './constants'
9092
import HibernateModal from './HibernateModal'
9193
import IssuesListingModal from './IssuesListingModal'
9294
import { SourceInfo } from './SourceInfo'
@@ -524,7 +526,7 @@ const Details: React.FC<DetailsType> = ({
524526
setShowAppStatusModal(true)
525527
}
526528

527-
const renderAppDetailsCDButton = () =>
529+
const renderSelectImageButton = () =>
528530
appDetails && (
529531
<AppDetailsCDButton
530532
appId={appDetails.appId}
@@ -540,9 +542,17 @@ const Details: React.FC<DetailsType> = ({
540542
deploymentUserActionState,
541543
triggerType: appDetails.triggerType,
542544
}}
543-
isForEmptyState
544545
handleSuccess={callAppDetailsAPI}
545-
isAppView={isAppView}
546+
gaEvent={
547+
isAppView
548+
? DA_APP_DETAILS_GA_EVENTS.DeployButtonClicked
549+
: AG_APP_DETAILS_GA_EVENTS.DeployButtonClicked
550+
}
551+
buttonProps={{
552+
dataTestId: 'select-image-to-deploy',
553+
startIcon: <Icon name="ic-hand-pointing" color={null} />,
554+
text: 'Select Image to deploy',
555+
}}
546556
/>
547557
)
548558

@@ -577,7 +587,7 @@ const Details: React.FC<DetailsType> = ({
577587
image={noGroups}
578588
title={ERROR_EMPTY_SCREEN.ALL_SET_GO_CONFIGURE}
579589
subtitle={ERROR_EMPTY_SCREEN.DEPLOYEMENT_WILL_BE_HERE}
580-
renderCustomButton={renderAppDetailsCDButton}
590+
renderCustomButton={renderSelectImageButton}
581591
/>
582592
)}
583593
</>

src/components/app/details/appDetails/AppDetailsCDButton.tsx

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,19 @@ import { useHistory, useLocation } from 'react-router-dom'
2020

2121
import {
2222
Button,
23-
ButtonVariantType,
24-
ComponentSizeType,
2523
DeploymentNodeType,
26-
Icon,
2724
stopPropagation,
2825
useSearchString,
2926
VisibleModal,
3027
} from '@devtron-labs/devtron-fe-common-lib'
3128

32-
import { BUTTON_TITLE } from '../../../ApplicationGroup/Constants'
3329
import { importComponentFromFELibrary } from '../../../common'
3430
import { URL_PARAM_MODE_TYPE } from '../../../common/helpers/types'
3531
import { getModuleInfo } from '../../../v2/devtronStackManager/DevtronStackManager.service'
3632
import { AppDetailsCDButtonType } from '../../types'
3733
import CDMaterial from '../triggerView/cdMaterial'
3834
import { TRIGGER_VIEW_PARAMS } from '../triggerView/Constants'
3935
import { MATERIAL_TYPE } from '../triggerView/types'
40-
import { AG_APP_DETAILS_GA_EVENTS, DA_APP_DETAILS_GA_EVENTS } from './constants'
41-
import { getDeployButtonConfig } from './utils'
4236

4337
const ApprovalMaterialModal = importComponentFromFELibrary('ApprovalMaterialModal')
4438

@@ -49,19 +43,19 @@ const AppDetailsCDButton = ({
4943
cdModal,
5044
deploymentAppType,
5145
isVirtualEnvironment,
52-
deploymentUserActionState,
5346
loadingDetails,
5447
environmentName,
55-
isForEmptyState = false,
5648
handleSuccess,
57-
isAppView,
5849
isForRollback = false,
50+
buttonProps,
51+
gaEvent,
5952
}: AppDetailsCDButtonType): JSX.Element => {
6053
const history = useHistory()
6154
const { searchParams } = useSearchString()
6255
const location = useLocation()
6356
const queryParams = new URLSearchParams(location.search)
6457
const mode = queryParams.get('mode')
58+
6559
// deriving from URL and not props as on app details multiple instances exist, but we are rendering only one at a time
6660
const materialType = queryParams.get('materialType')
6761

@@ -78,42 +72,14 @@ const AppDetailsCDButton = ({
7872
search: new URLSearchParams(newParams).toString(),
7973
})
8074

81-
if (isForRollback) {
82-
ReactGA.event(DA_APP_DETAILS_GA_EVENTS.RollbackButtonClicked)
83-
return
84-
}
85-
ReactGA.event(
86-
isAppView ? DA_APP_DETAILS_GA_EVENTS.DeployButtonClicked : AG_APP_DETAILS_GA_EVENTS.DeployButtonClicked,
87-
)
75+
ReactGA.event(gaEvent)
8876
}
8977

9078
const closeCDModal = (e: React.MouseEvent): void => {
9179
stopPropagation(e)
9280
history.push({ search: '' })
9381
}
9482

95-
const { buttonStyle, iconName } = getDeployButtonConfig(deploymentUserActionState, isForEmptyState)
96-
97-
const renderDeployButton = () =>
98-
isForRollback ? (
99-
<Button
100-
dataTestId="rollback-button"
101-
text="Rollback"
102-
variant={ButtonVariantType.text}
103-
onClick={onClickDeployButton}
104-
size={ComponentSizeType.small}
105-
/>
106-
) : (
107-
<Button
108-
dataTestId="deploy-button"
109-
size={isForEmptyState ? ComponentSizeType.large : ComponentSizeType.small}
110-
text={isForEmptyState ? 'Select Image to Deploy' : BUTTON_TITLE[DeploymentNodeType.CD]}
111-
startIcon={iconName && <Icon name={iconName} color={null} />}
112-
onClick={onClickDeployButton}
113-
style={buttonStyle}
114-
/>
115-
)
116-
11783
const node = {
11884
environmentName,
11985
parentEnvironmentName: cdModal.parentEnvironmentName,
@@ -165,7 +131,7 @@ const AppDetailsCDButton = ({
165131

166132
return (
167133
<>
168-
{renderDeployButton()}
134+
<Button {...buttonProps} onClick={onClickDeployButton} />
169135
{renderCDModal()}
170136
{renderApprovalMaterial()}
171137
</>

0 commit comments

Comments
 (0)