Skip to content

Commit

Permalink
Emit telemetry event on "Run job with input folder" checkbox click (#523
Browse files Browse the repository at this point in the history
)

* emit on package_input_folder click

* remove unnecessary onChange event inline typing
  • Loading branch information
andrii-i authored Jun 3, 2024
1 parent dbeb34f commit 8b13516
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/input-folder-checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { ChangeEvent } from 'react';
import { useTranslator } from '../hooks';
import { useEventLogger, useTranslator } from '../hooks';

import {
Checkbox,
Expand All @@ -13,6 +13,7 @@ export function PackageInputFolderControl(props: {
inputFile: string;
}): JSX.Element {
const trans = useTranslator('jupyterlab');
const log = useEventLogger();
const inputFilePath = props.inputFile.split('/');
inputFilePath.pop();

Expand All @@ -33,7 +34,14 @@ export function PackageInputFolderControl(props: {
<FormGroup>
<FormControlLabel
control={
<Checkbox onChange={props.onChange} name={'packageInputFolder'} />
<Checkbox
onChange={event => {
const checkboxEvent = event.target.checked ? 'check' : 'uncheck';
log(`create-job.options.package_input_folder.${checkboxEvent}`);
props.onChange(event);
}}
name={'packageInputFolder'}
/>
}
label={trans.__('Run job with input folder')}
aria-describedby="jp-package-input-folder-helper-text"
Expand Down

0 comments on commit 8b13516

Please sign in to comment.