Skip to content

Commit 3438925

Browse files
committed
chore: GA event for app metrics
1 parent 6a6df6a commit 3438925

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

src/components/ClusterNodes/ClusterList/ClusterList.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +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 === null ? <div /> : null}
41+
{KubeConfigRowCheckbox ? <BulkSelection showPagination={false} /> : <div />}
4242
{Object.entries(ClusterMapListSortableKeys).map(([cellName, cellKey]) => (
4343
<React.Fragment key={cellName}>
44-
{KubeConfigRowCheckbox && cellKey === ClusterMapListSortableKeys.CLUSTER_NAME && (
45-
<BulkSelection showPagination={false} />
46-
)}
4744
<SortableTableHeaderCell
4845
key={cellName}
4946
title={ClusterMapListSortableTitle[cellName]}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,12 @@ export const DA_APP_DETAILS_GA_EVENTS = {
2525
category: 'App Details',
2626
action: 'DA_APP_DETAIL_GO_TO_ENV_CONFIG',
2727
},
28+
MetricsApplyTimeChange: {
29+
category: 'App Metrics',
30+
action: 'DA_APP_DETAIL_METRICS_APPLY_TIME_RANGE',
31+
},
32+
MetricsPresetTimeRange: {
33+
category: 'App Metrics',
34+
action: 'DA_APP_DETAIL_METRICS_PRESET_TIME_RANGE',
35+
},
2836
}

src/components/common/DatePickers/DayPickerRangeController.tsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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, endDate, endStr) => () => {
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() {
@@ -179,10 +184,7 @@ export class DatePickerType2 extends Component<DatePickerType2Props, any> {
179184
<button
180185
type="button"
181186
className="cta small"
182-
onClick={() => {
183-
this.setState({ showCalendar: false })
184-
this.props.handleApply()
185-
}}
187+
onClick={this.onClickApplyTimeChange}
186188
>
187189
Apply Time Range
188190
</button>
@@ -209,15 +211,7 @@ export class DatePickerType2 extends Component<DatePickerType2Props, any> {
209211
type="button"
210212
key={text}
211213
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-
}}
214+
onClick={this.onClickPredefinedTimeRange(startDate, endDate, endStr)}
221215
>
222216
{text}
223217
</button>

0 commit comments

Comments
 (0)