Skip to content

Commit

Permalink
[Desktop] Add install screen stepper change metrics (#2261)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Jan 16, 2025
1 parent ff445f5 commit 37abdbe
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
},
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
"@comfyorg/comfyui-electron-types": "^0.4.7",
"@comfyorg/comfyui-electron-types": "^0.4.8",
"@comfyorg/litegraph": "^0.8.60",
"@primevue/themes": "^4.0.5",
"@sentry/vue": "^8.48.0",
Expand Down
18 changes: 16 additions & 2 deletions src/views/InstallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Stepper
class="h-full p-8 2xl:p-16"
value="0"
@update:value="setHighestStep"
@update:value="handleStepChange"
>
<StepList class="select-none">
<Step value="0">
Expand Down Expand Up @@ -137,6 +137,14 @@ const allowMetrics = ref(true)
/** Forces each install step to be visited at least once. */
const highestStep = ref(0)
const handleStepChange = (value: string | number) => {
setHighestStep(value)
electronAPI().Config.trackEvent('install_stepper_change', {
step: value
})
}
const setHighestStep = (value: string | number) => {
const int = typeof value === 'number' ? value : parseInt(value, 10)
if (!isNaN(int) && int > highestStep.value) highestStep.value = int
Expand Down Expand Up @@ -167,8 +175,14 @@ onMounted(async () => {
if (!electron) return
const detectedGpu = await electron.Config.getDetectedGpu()
if (detectedGpu === 'mps' || detectedGpu === 'nvidia')
if (detectedGpu === 'mps' || detectedGpu === 'nvidia') {
device.value = detectedGpu
}
electronAPI().Config.trackEvent('install_stepper_change', {
step: '0',
gpu: detectedGpu
})
})
</script>

Expand Down
6 changes: 5 additions & 1 deletion vite.electron.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ const mockElectronAPI: Plugin = {
changeTheme: () => {},
Config: {
setWindowStyle: () => {},
getWindowStyle: () => Promise.resolve('default')
getWindowStyle: () => Promise.resolve('default'),
trackEvent: (event_name, event_data) => {
console.log('trackEvent', event_name, event_data)
},
getDetectedGpu: () => Promise.resolve('nvidia')
}
};`
}
Expand Down

0 comments on commit 37abdbe

Please sign in to comment.