Skip to content

Commit 42a8861

Browse files
committed
Handle skipped steps
1 parent 1d354ac commit 42a8861

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

src/plugins/setup.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,19 @@ export default createPlugin(
5757
},
5858
async (progress, cancellationToken) => {
5959
/////////////////////////////////////////////////////////////////////
60+
let cliInstallSkipped: boolean = false;
61+
let authenticationSkipped: boolean = false;
6062
{
6163
const installationStartedAt = new Date().toISOString();
62-
const { cancelled } = await runInstallProcess(
64+
65+
const { cancelled, skipped } = await runInstallProcess(
6366
progress,
6467
cancellationToken,
6568
outputChannel,
6669
telemetry,
6770
origin_trigger,
6871
);
72+
cliInstallSkipped = skipped === true;
6973
if (cancelled || cancellationToken.isCancellationRequested) {
7074
telemetry.track({
7175
name: "emulator_installed",
@@ -116,6 +120,7 @@ export default createPlugin(
116120
progress.report({
117121
message: "Skipping authentication...",
118122
});
123+
authenticationSkipped = true;
119124
telemetry.track({
120125
name: "auth_token_configured",
121126
payload: {
@@ -306,7 +311,17 @@ export default createPlugin(
306311
});
307312
}
308313

309-
telemetry.track(get_setup_ended_completed(await readAuthToken()));
314+
const cliStatus = cliInstallSkipped ? "SKIPPED" : "COMPLETED";
315+
const authenticationStatus = authenticationSkipped
316+
? "SKIPPED"
317+
: "COMPLETED";
318+
telemetry.track(
319+
get_setup_ended_completed(
320+
cliStatus,
321+
authenticationStatus,
322+
await readAuthToken(),
323+
),
324+
);
310325
},
311326
);
312327
},

src/utils/install.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function runInstallProcess(
4040
outputChannel: LogOutputChannel,
4141
telemetry: Telemetry,
4242
origin?: "extension_startup" | "manual_trigger",
43-
): Promise<{ cancelled: boolean }> {
43+
): Promise<{ cancelled: boolean; skipped?: boolean }> {
4444
/////////////////////////////////////////////////////////////////////
4545
const origin_trigger = origin ? origin : "manual_trigger";
4646
progress.report({
@@ -71,7 +71,7 @@ export async function runInstallProcess(
7171
},
7272
});
7373
await minDelay();
74-
return { cancelled: false };
74+
return { cancelled: false, skipped: true };
7575
}
7676

7777
/////////////////////////////////////////////////////////////////////

src/utils/telemetry.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,11 @@ export function get_setup_ended_on_image_prefetch_cancelled(
383383
};
384384
}
385385

386-
export function get_setup_ended_completed(auth_token: string): Events {
386+
export function get_setup_ended_completed(
387+
cli_status: "COMPLETED" | "SKIPPED",
388+
authentication_status: "COMPLETED" | "SKIPPED",
389+
auth_token: string,
390+
): Events {
387391
return {
388392
name: "setup_ended",
389393
payload: {
@@ -394,14 +398,14 @@ export function get_setup_ended_completed(auth_token: string): Events {
394398
is_first_step: true,
395399
is_last_step: false,
396400
step_order: 1,
397-
status: "COMPLETED",
401+
status: cli_status,
398402
},
399403
{
400404
name: "auth_token_configured",
401405
is_first_step: false,
402406
is_last_step: false,
403407
step_order: 2,
404-
status: "COMPLETED",
408+
status: authentication_status,
405409
},
406410
{
407411
name: "license_setup_ended",

0 commit comments

Comments
 (0)