Skip to content

Commit 6b5cc51

Browse files
authored
Merge pull request #2649 from devtron-labs/feat/navigate-to-env-overide
feat: Navigate button from app details to env override
2 parents 2dcb316 + ffd50e2 commit 6b5cc51

File tree

9 files changed

+82
-44
lines changed

9 files changed

+82
-44
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.11.0-pre-3",
7+
"@devtron-labs/devtron-fe-common-lib": "1.11.0-pre-4",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/components/ClusterNodes/ClusterList/ClusterList.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ const ClusterList = ({
3838
return (
3939
<div data-testid="cluster-list-container" className="flexbox-col flex-grow-1">
4040
<div className="cluster-list-row fw-6 cn-7 fs-12 dc__border-bottom pt-8 pb-8 pr-20 pl-20 dc__uppercase bg__primary dc__position-sticky dc__top-0 dc__zi-3">
41+
{KubeConfigRowCheckbox ? <BulkSelection showPagination={false} /> : <div />}
4142
{Object.entries(ClusterMapListSortableKeys).map(([cellName, cellKey]) => (
4243
<React.Fragment key={cellName}>
43-
{KubeConfigRowCheckbox && cellKey === ClusterMapListSortableKeys.CLUSTER_NAME && (
44-
<BulkSelection showPagination={false} />
45-
)}
4644
<SortableTableHeaderCell
4745
key={cellName}
4846
title={ClusterMapListSortableTitle[cellName]}

src/components/ClusterNodes/ClusterList/ClusterListRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const ClusterListRow = ({
6767
>
6868
{KubeConfigRowCheckbox && <KubeConfigRowCheckbox clusterData={clusterData} />}
6969
{!isIdentifierSelected && identifierCount === 0 && (
70-
<div className="dc__visible-hover--hide-child flex left">
70+
<div className={`${KubeConfigRowCheckbox ? 'dc__visible-hover--hide-child' : ''} flex left`}>
7171
<Icon name="ic-bg-cluster" color={null} size={24} />
7272
</div>
7373
)}

src/components/app/details/AppHeader.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
useBreadcrumb,
2929
} from '@devtron-labs/devtron-fe-common-lib'
3030

31-
import { ReactComponent as Settings } from '../../../assets/icons/ic-settings.svg'
3231
import { URLS } from '../../../config'
3332
import { FilterParentType } from '../../ApplicationGroup/AppGroup.types'
3433
import AppGroupAppFilter from '../../ApplicationGroup/AppGroupAppFilter'
@@ -231,7 +230,7 @@ export const AppHeader = ({
231230
id: 'app-configuration-tab',
232231
label: 'Configurations',
233232
tabType: 'navLink',
234-
icon: Settings,
233+
icon: 'ic-sliders-vertical',
235234
props: {
236235
to: `${match.url}/${CommonURLS.APP_CONFIG}`,
237236
'data-action': 'App Configuration Clicked',

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import React from 'react'
18+
import ReactGA from 'react-ga4'
1819
import { useHistory, useLocation } from 'react-router-dom'
1920

2021
import {
@@ -39,6 +40,7 @@ import { AppDetailsCDButtonType } from '../../types'
3940
import CDMaterial from '../triggerView/cdMaterial'
4041
import { TRIGGER_VIEW_PARAMS } from '../triggerView/Constants'
4142
import { MATERIAL_TYPE } from '../triggerView/types'
43+
import { DA_APP_DETAILS_GA_EVENTS } from './constants'
4244
import { getDeployButtonStyle } from './utils'
4345

4446
const ApprovalMaterialModal = importComponentFromFELibrary('ApprovalMaterialModal')
@@ -69,6 +71,8 @@ const AppDetailsCDButton = ({
6971
history.push({
7072
search: new URLSearchParams(newParams).toString(),
7173
})
74+
75+
ReactGA.event(DA_APP_DETAILS_GA_EVENTS.DeployButtonClicked)
7276
}
7377

7478
const closeCDModal = (e: React.MouseEvent): void => {

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

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
*/
1616

1717
import { useMemo, useState } from 'react'
18-
import { Link, useParams } from 'react-router-dom'
18+
import { Link, useHistory, useParams } from 'react-router-dom'
19+
import ReactGA from 'react-ga4'
1920
import moment from 'moment'
2021
import {
2122
Button,
@@ -26,13 +27,14 @@ import {
2627
DATE_TIME_FORMATS,
2728
DeploymentAppTypes,
2829
handleUTCTime,
30+
Icon,
2931
Progressing,
3032
ReleaseMode,
3133
showError,
3234
Tooltip,
3335
} from '@devtron-labs/devtron-fe-common-lib'
3436
import { ReactComponent as ICCamera } from '@Icons/ic-camera.svg'
35-
import { URLS } from '../../../../config'
37+
import { APP_COMPOSE_STAGE, getAppComposeURL, URLS } from '../../../../config'
3638
import { EnvSelector } from './AppDetails'
3739
import { DeploymentAppTypeNameMapping } from '../../../../config/constantMessaging'
3840
import { Nodes, SourceInfoType } from '../../types'
@@ -51,6 +53,7 @@ import { ReactComponent as Trash } from '../../../../assets/icons/ic-delete-dots
5153
import { ReactComponent as ScaleDown } from '../../../../assets/icons/ic-scale-down.svg'
5254
import HelmAppConfigApplyStatusCard from '@Components/v2/appDetails/sourceInfo/environmentStatus/HelmAppConfigApplyStatusCard'
5355
import { HibernationModalTypes } from './appDetails.type'
56+
import { DA_APP_DETAILS_GA_EVENTS } from './constants'
5457

5558
const AppDetailsDownloadCard = importComponentFromFELibrary('AppDetailsDownloadCard')
5659
const DeploymentWindowStatusCard = importComponentFromFELibrary('DeploymentWindowStatusCard')
@@ -93,6 +96,8 @@ export const SourceInfo = ({
9396
appDetails?.releaseMode === ReleaseMode.MIGRATE_EXTERNAL_APPS && !appDetails?.isPipelineTriggered
9497
const isIsolatedEnv = isVirtualEnvironment && !!appDetails?.resourceTree
9598

99+
const history = useHistory()
100+
96101
if (
97102
['progressing', 'degraded'].includes(status?.toLowerCase()) &&
98103
Array.isArray(conditions) &&
@@ -151,6 +156,11 @@ export const SourceInfo = ({
151156
return <div className="flex left mb-16">{loadingCards}</div>
152157
}
153158

159+
const onClickSliderVerticalButton = () => {
160+
history.push(`${getAppComposeURL(params.appId, APP_COMPOSE_STAGE.ENV_OVERRIDE, false, false)}/${params.envId}`)
161+
ReactGA.event(DA_APP_DETAILS_GA_EVENTS.GoToEnvironmentConfiguration)
162+
}
163+
154164
const renderDevtronAppsEnvironmentSelector = (environment) => {
155165
// If moving to a component then move getIsApprovalConfigured with it as well with memoization.
156166
const isApprovalConfigured = appDetails?.isApprovalPolicyApplicable ?? false
@@ -256,7 +266,7 @@ export const SourceInfo = ({
256266
showTooltip={isApprovalConfigured}
257267
tooltipProps={{
258268
content: 'Application deployment requiring approval cannot be hibernated.',
259-
placement: 'bottom-end',
269+
placement: 'bottom',
260270
}}
261271
/>
262272
)}
@@ -274,10 +284,25 @@ export const SourceInfo = ({
274284
showTooltip={isApprovalConfigured}
275285
tooltipProps={{
276286
content: 'Application deployment requiring approval cannot be hibernated.',
277-
placement: 'bottom-end',
287+
placement: 'bottom',
278288
}}
279289
/>
280290
)}
291+
<Button
292+
dataTestId="app-details-env-config-button"
293+
size={ComponentSizeType.small}
294+
icon={<Icon name="ic-sliders-vertical" color={null} />}
295+
variant={ButtonVariantType.secondary}
296+
onClick={onClickSliderVerticalButton}
297+
component={ButtonComponentType.button}
298+
style={ButtonStyleType.neutral}
299+
ariaLabel="Go to Environment Configuration"
300+
showTooltip
301+
tooltipProps={{
302+
content: 'Go to Environment Config',
303+
placement: 'bottom',
304+
}}
305+
/>
281306
{window._env_.FEATURE_SWAP_TRAFFIC_ENABLE &&
282307
SwapTraffic &&
283308
!!appDetails.pcoId &&
@@ -395,13 +420,14 @@ export const SourceInfo = ({
395420
filteredEnvIds={filteredEnvIds}
396421
/>
397422
)}
398-
{!appDetails?.deploymentAppDeleteRequest && !appMigratedFromExternalSourceAndIsNotTriggered && (
399-
<SecurityVulnerabilityCard
400-
cardLoading={cardLoading}
401-
appId={params.appId}
402-
envId={params.envId}
403-
/>
404-
)}
423+
{!appDetails?.deploymentAppDeleteRequest &&
424+
!appMigratedFromExternalSourceAndIsNotTriggered && (
425+
<SecurityVulnerabilityCard
426+
cardLoading={cardLoading}
427+
appId={params.appId}
428+
envId={params.envId}
429+
/>
430+
)}
405431
<div className="flex right ml-auto">
406432
{appDetails?.appStoreChartId && (
407433
<>

src/components/app/details/appDetails/constants.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,25 @@
1414
* limitations under the License.
1515
*/
1616

17+
import ReactGA from 'react-ga4'
18+
1719
export const APP_METRICS_CALENDAR_INPUT_DATE_FORMAT = 'DD-MM-YYYY hh:mm:ss'
20+
21+
export const DA_APP_DETAILS_GA_EVENTS: Record<string, Parameters<typeof ReactGA.event>[0]> = {
22+
DeployButtonClicked: {
23+
category: 'App Details',
24+
action: 'DA_APP_DETAIL_DEPLOY',
25+
},
26+
GoToEnvironmentConfiguration: {
27+
category: 'App Details',
28+
action: 'DA_APP_DETAIL_GO_TO_ENV_CONFIG',
29+
},
30+
MetricsApplyTimeChange: {
31+
category: 'App Metrics',
32+
action: 'DA_APP_DETAIL_METRICS_APPLY_TIME_RANGE',
33+
},
34+
MetricsPresetTimeRange: {
35+
category: 'App Metrics',
36+
action: 'DA_APP_DETAIL_METRICS_PRESET_TIME_RANGE',
37+
},
38+
}

src/components/common/DatePickers/DayPickerRangeController.tsx

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { Component } from 'react'
17+
import { Component } from 'react'
1818
import 'react-dates/initialize'
1919
import 'react-dates/lib/css/_datepicker.css'
2020
import CustomizableCalendarDay from 'react-dates/esm/components/CustomizableCalendarDay.js'
@@ -23,6 +23,7 @@ import moment, { Moment } from 'moment'
2323
import { isInclusivelyBeforeDay, DayPickerRangeController } from 'react-dates'
2424
import './calendar.css'
2525
import { ReactComponent as ArrowDown } from '../../../assets/icons/ic-chevron-down.svg'
26+
import { DA_APP_DETAILS_GA_EVENTS } from '@Components/app/details/appDetails/constants'
2627

2728
interface DatePickerType2Props {
2829
calendar
@@ -126,12 +127,16 @@ export class DatePickerType2 extends Component<DatePickerType2Props, any> {
126127
this.renderDatePresets = this.renderDatePresets.bind(this)
127128
}
128129

129-
getInitialVisibleMonth = () => {
130-
return this.props.calendar.endDate
130+
onClickApplyTimeChange = () => {
131+
this.setState({ showCalendar: false })
132+
this.props.handleApply()
133+
ReactGA.event(DA_APP_DETAILS_GA_EVENTS.MetricsApplyTimeChange)
131134
}
132135

133-
handleIsDayBlocked(day) {
134-
return false
136+
onClickPredefinedTimeRange = (startDate: Moment, endDate: Moment, endStr: string) => () => {
137+
ReactGA.event(DA_APP_DETAILS_GA_EVENTS.MetricsPresetTimeRange)
138+
this.props.handlePredefinedRange(startDate, endDate, endStr)
139+
this.setState({ showCalendar: false })
135140
}
136141

137142
renderDatePresets() {
@@ -176,14 +181,7 @@ export class DatePickerType2 extends Component<DatePickerType2Props, any> {
176181
}}
177182
/>
178183
</label>
179-
<button
180-
type="button"
181-
className="cta small"
182-
onClick={() => {
183-
this.setState({ showCalendar: false })
184-
this.props.handleApply()
185-
}}
186-
>
184+
<button type="button" className="cta small" onClick={this.onClickApplyTimeChange}>
187185
Apply Time Range
188186
</button>
189187
</div>
@@ -209,15 +207,7 @@ export class DatePickerType2 extends Component<DatePickerType2Props, any> {
209207
type="button"
210208
key={text}
211209
style={{ ...buttonStyles, textAlign: 'left' }}
212-
onClick={() => {
213-
ReactGA.event({
214-
category: 'Deployment Metrics',
215-
action: 'Date Range Changed',
216-
label: 'Predefined',
217-
})
218-
this.props.handlePredefinedRange(startDate, endDate, endStr)
219-
this.setState({ showCalendar: false })
220-
}}
210+
onClick={this.onClickPredefinedTimeRange(startDate, endDate, endStr)}
221211
>
222212
{text}
223213
</button>

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,10 +1126,10 @@
11261126
dependencies:
11271127
"@jridgewell/trace-mapping" "0.3.9"
11281128

1129-
"@devtron-labs/[email protected]3":
1130-
version "1.11.0-pre-3"
1131-
resolved "https://registry.yarnpkg.com/@devtron-labs/devtron-fe-common-lib/-/devtron-fe-common-lib-1.11.0-pre-3.tgz#cbad0dd604840f4c4101ea3ee217cf7d67b3bd17"
1132-
integrity sha512-L7i1VqQFXgrwUrm5KLZ9jGqtVgqJSps/LjbycprN8fiuNkDaPZCb3uevcP8iTmVoxyr+wo83zoS0U+sNcdP8fg==
1129+
"@devtron-labs/[email protected]4":
1130+
version "1.11.0-pre-4"
1131+
resolved "https://registry.yarnpkg.com/@devtron-labs/devtron-fe-common-lib/-/devtron-fe-common-lib-1.11.0-pre-4.tgz#35a29201d47748fde6fee40d443e54d90eb4d63c"
1132+
integrity sha512-I6u/ZXCKD+Vg0UEbFC+Pwt6ZGUa7nRBtG4ZWgNrAxNGFqnmbTl3odwfQCvVXkHe9FisQIcwRkH1E/Yl+JjeJuQ==
11331133
dependencies:
11341134
"@codemirror/lang-json" "6.0.1"
11351135
"@codemirror/lang-yaml" "6.1.2"

0 commit comments

Comments
 (0)