Skip to content

Commit 89f56cb

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

File tree

5 files changed

+27
-14
lines changed

5 files changed

+27
-14
lines changed

components/dashboard/src/App.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,7 @@ function App() {
509509
if (showUserIdePreference) {
510510
toRender = (
511511
<StartPage phase={StartPhase.Checking}>
512-
<SelectIDEModal
513-
onClose={() => {
514-
setShowUserIdePreference(false);
515-
}}
516-
/>
512+
<SelectIDEModal location="workspace_start" onClose={() => setShowUserIdePreference(false)} />
517513
</StartPage>
518514
);
519515
} else {

components/dashboard/src/settings/Preferences.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default function Preferences() {
6060
>
6161
<h3>Editor</h3>
6262
<p className="text-base text-gray-500 dark:text-gray-400">Choose the editor for opening workspaces.</p>
63-
<SelectIDE />
63+
<SelectIDE location="preferences" />
6464
<h3 className="mt-12">Theme</h3>
6565
<p className="text-base text-gray-500 dark:text-gray-400">Early bird or night owl? Choose your side.</p>
6666
<div className="mt-4 space-x-4 flex">

components/dashboard/src/settings/SelectIDE.tsx

Lines changed: 13 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,7 @@ 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(user, selectedIde, useLatestVersion, props.location);
4858
props.updateUserContext && setUser({ ...newUserData });
4959
};
5060

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)