Skip to content

Commit 9c75602

Browse files
committed
[dashboard] add location for ide_configuration_changed track event
1 parent e2d18d0 commit 9c75602

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

components/dashboard/src/settings/SelectIDE.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,18 @@ import { UserContext } from "../user-context";
1414
import CheckBox from "../components/CheckBox";
1515
import { User } from "@gitpod/gitpod-protocol";
1616

17+
export type IDEChangedTrackLocation = "workspace_list" | "workspace_start" | "preferences";
1718
interface SelectIDEProps {
1819
updateUserContext?: boolean;
20+
location?: IDEChangedTrackLocation;
1921
}
2022

21-
export const updateUserIDEInfo = async (user: User, selectedIde: string, useLatestVersion: boolean) => {
23+
export const updateUserIDEInfo = async (
24+
user: User,
25+
selectedIde: string,
26+
useLatestVersion: boolean,
27+
location: IDEChangedTrackLocation,
28+
) => {
2229
const additionalData = user?.additionalData ?? {};
2330
const settings = additionalData.ideSettings ?? {};
2431
settings.settingVersion = "2.0";
@@ -28,7 +35,10 @@ export const updateUserIDEInfo = async (user: User, selectedIde: string, useLate
2835
getGitpodService()
2936
.server.trackEvent({
3037
event: "ide_configuration_changed",
31-
properties: settings,
38+
properties: {
39+
...settings,
40+
location,
41+
},
3242
})
3343
.then()
3444
.catch(console.error);
@@ -44,7 +54,12 @@ export default function SelectIDE(props: SelectIDEProps) {
4454
}, []);
4555

4656
const actualUpdateUserIDEInfo = async (user: User, selectedIde: string, useLatestVersion: boolean) => {
47-
const newUserData = await updateUserIDEInfo(user, selectedIde, useLatestVersion);
57+
const newUserData = await updateUserIDEInfo(
58+
user,
59+
selectedIde,
60+
useLatestVersion,
61+
props.location ?? "preferences",
62+
);
4863
props.updateUserContext && setUser({ ...newUserData });
4964
};
5065

components/dashboard/src/settings/SelectIDEModal.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@
77
import { useState, useContext } from "react";
88
import { Link } from "react-router-dom";
99
import { User } from "@gitpod/gitpod-protocol";
10-
import SelectIDE, { updateUserIDEInfo } from "./SelectIDE";
10+
import SelectIDE, { IDEChangedTrackLocation, updateUserIDEInfo } from "./SelectIDE";
1111
import Modal from "../components/Modal";
1212
import { UserContext } from "../user-context";
1313

14-
export default function (props: { onClose?: () => void }) {
14+
export interface SelectIDEModalProps {
15+
location: IDEChangedTrackLocation;
16+
onClose?: () => void;
17+
}
18+
19+
export default function (props: SelectIDEModalProps) {
1520
const { user, setUser } = useContext(UserContext);
1621
const [visible, setVisible] = useState(true);
1722

1823
const actualUpdateUserIDEInfo = async (user: User, selectedIde: string, useLatestVersion: boolean) => {
19-
const newUserData = await updateUserIDEInfo(user, selectedIde, useLatestVersion);
24+
const newUserData = await updateUserIDEInfo(user, selectedIde, useLatestVersion, props.location);
2025
setUser({ ...newUserData });
2126
};
2227

@@ -43,7 +48,7 @@ export default function (props: { onClose?: () => void }) {
4348
</Link>
4449
.
4550
</p>
46-
<SelectIDE updateUserContext={false} />
51+
<SelectIDE updateUserContext={false} location={props.location} />
4752
</div>
4853
<div className="flex justify-end mt-6">
4954
<button onClick={handleContinue} className="ml-2">

components/dashboard/src/workspaces/Workspaces.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ export default function () {
6262
return (
6363
<>
6464
<Header title="Workspaces" subtitle="Manage recent and stopped workspaces." />
65-
{isOnboardingUser && <SelectIDEModal />}
65+
66+
{isOnboardingUser && <SelectIDEModal location={"workspace_list"} />}
67+
6668
{workspaceModel?.initialized &&
6769
(activeWorkspaces.length > 0 || inactiveWorkspaces.length > 0 || workspaceModel.searchTerm ? (
6870
<>

0 commit comments

Comments
 (0)