From 669d80172db0d23a32512a197b0a23abc56c46e9 Mon Sep 17 00:00:00 2001 From: amitjoshi438 <54068463+amitjoshi438@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:43:02 +0530 Subject: [PATCH 1/2] ecsInitialization fix for desktop (#1039) Co-authored-by: amitjoshi --- src/client/extension.ts | 11 ++++++----- src/common/ecs-features/ecsFeatureClient.ts | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/client/extension.ts b/src/client/extension.ts index cd2e5ebd8..bc3460891 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -185,10 +185,6 @@ export async function activate( const pacTerminal = new PacTerminal(_context, _telemetry, cliPath); _context.subscriptions.push(cli); _context.subscriptions.push(pacTerminal); - const workspaceFolders = - vscode.workspace.workspaceFolders?.map( - (fl) => ({ ...fl, uri: fl.uri.fsPath } as WorkspaceFolder) - ) || []; _context.subscriptions.push( orgChangeEvent(async (orgDetails: ActiveOrgOutput) => { @@ -213,7 +209,7 @@ export async function activate( TenantID: TenantID[0].Value, Region: artemisResponse.stamp }, - PowerPagesClientName); + PowerPagesClientName, true); } oneDSLoggerWrapper.instantiate(geoName, geoLongName); @@ -226,6 +222,11 @@ export async function activate( }) ); + + const workspaceFolders = + vscode.workspace.workspaceFolders?.map( + (fl) => ({ ...fl, uri: fl.uri.fsPath } as WorkspaceFolder) + ) || []; // TODO: Handle for VSCode.dev also if (workspaceContainsPortalConfigFolder(workspaceFolders)) { let telemetryData = ''; diff --git a/src/common/ecs-features/ecsFeatureClient.ts b/src/common/ecs-features/ecsFeatureClient.ts index 38df90b23..2b58945e6 100644 --- a/src/common/ecs-features/ecsFeatureClient.ts +++ b/src/common/ecs-features/ecsFeatureClient.ts @@ -16,8 +16,8 @@ export abstract class ECSFeaturesClient { // Initialize ECSFeatureClient - any client config can be fetched with utility function like below // EnableMultifileVscodeWeb.getConfig().enableMultifileVscodeWeb - public static async init(telemetry: ITelemetry | TelemetryReporter, filters: ECSAPIFeatureFlagFilters, clientName: string) { - if (this._ecsConfig) return; + public static async init(telemetry: ITelemetry | TelemetryReporter, filters: ECSAPIFeatureFlagFilters, clientName: string, force = false) { + if (this._ecsConfig && !force) return const requestURL = createECSRequestURL(filters, clientName); try { From df9da838024560996da7694ef4a5cfb4963c3861 Mon Sep 17 00:00:00 2001 From: amitjoshi438 <54068463+amitjoshi438@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:09:27 +0530 Subject: [PATCH 2/2] Refactor telemetry constants and add GitHub Copilot integration event (#1041) Co-authored-by: amitjoshi --- src/common/copilot/PowerPagesCopilot.ts | 3 ++- src/common/copilot/telemetry/telemetryConstants.ts | 3 +++ .../welcome-notification/CopilotNotificationPanel.ts | 12 ++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/common/copilot/PowerPagesCopilot.ts b/src/common/copilot/PowerPagesCopilot.ts index 00579965d..aac3fa795 100644 --- a/src/common/copilot/PowerPagesCopilot.ts +++ b/src/common/copilot/PowerPagesCopilot.ts @@ -15,7 +15,7 @@ import { IOrgInfo } from './model'; import { checkCopilotAvailability, escapeDollarSign, getActiveEditorContent, getNonce, getSelectedCode, getSelectedCodeLineRange, getUserName, openWalkthrough, showConnectedOrgMessage, showInputBoxAndGetOrgUrl, showProgressWithNotification } from "../utilities/Utils"; import { CESUserFeedback } from "./user-feedback/CESSurvey"; import { ActiveOrgOutput } from "../../client/pac/PacTypes"; -import { CopilotWalkthroughEvent, CopilotCopyCodeToClipboardEvent, CopilotInsertCodeToEditorEvent, CopilotLoadedEvent, CopilotOrgChangedEvent, CopilotUserFeedbackThumbsDownEvent, CopilotUserFeedbackThumbsUpEvent, CopilotUserPromptedEvent, CopilotCodeLineCountEvent, CopilotClearChatEvent, CopilotExplainCode, CopilotExplainCodeSize, CopilotNotAvailableECSConfig } from "./telemetry/telemetryConstants"; +import { CopilotWalkthroughEvent, CopilotCopyCodeToClipboardEvent, CopilotInsertCodeToEditorEvent, CopilotLoadedEvent, CopilotOrgChangedEvent, CopilotUserFeedbackThumbsDownEvent, CopilotUserFeedbackThumbsUpEvent, CopilotUserPromptedEvent, CopilotCodeLineCountEvent, CopilotClearChatEvent, CopilotExplainCode, CopilotExplainCodeSize, CopilotNotAvailableECSConfig, CopilotPanelTryGitHubCopilotClicked } from "./telemetry/telemetryConstants"; import { sendTelemetryEvent } from "./telemetry/copilotTelemetry"; import TelemetryReporter from "@vscode/extension-telemetry"; import { getEntityColumns, getEntityName, getFormXml } from "./dataverseMetadata"; @@ -295,6 +295,7 @@ export class PowerPagesCopilot implements vscode.WebviewViewProvider { } case "openGitHubCopilotLink": { //Open the GitHub Copilot Chat with @powerpages if GitHub Copilot Chat is installed + sendTelemetryEvent(this.telemetry, { eventName: CopilotPanelTryGitHubCopilotClicked, copilotSessionId: sessionID, orgId: orgID, userId: userID }); if (vscode.extensions.getExtension(GITHUB_COPILOT_CHAT_EXT)) { vscode.commands.executeCommand('workbench.action.chat.open', PowerPagesParticipantPrompt); } else { diff --git a/src/common/copilot/telemetry/telemetryConstants.ts b/src/common/copilot/telemetry/telemetryConstants.ts index 9baddb0d2..8567778df 100644 --- a/src/common/copilot/telemetry/telemetryConstants.ts +++ b/src/common/copilot/telemetry/telemetryConstants.ts @@ -37,3 +37,6 @@ export const CopilotNotAvailableECSConfig = 'CopilotNotAvailableECSConfig'; export const CopilotExplainCode = 'CopilotExplainCode'; export const CopilotExplainCodeSize = 'CopilotExplainCodeSize'; export const CopilotNpsAuthenticationCompleted = "CopilotNpsAuthenticationCompleted"; +export const CopilotNotificationTryGitHubCopilotClicked = 'CopilotNotificationTryGitHubCopilotClicked'; +export const CopilotPanelTryGitHubCopilotClicked = 'CopilotPanelTryGitHubCopilotClicked '; + diff --git a/src/common/copilot/welcome-notification/CopilotNotificationPanel.ts b/src/common/copilot/welcome-notification/CopilotNotificationPanel.ts index 28fcb98f2..50dedcebd 100644 --- a/src/common/copilot/welcome-notification/CopilotNotificationPanel.ts +++ b/src/common/copilot/welcome-notification/CopilotNotificationPanel.ts @@ -6,8 +6,8 @@ import * as vscode from "vscode"; import { getNonce } from "../../utilities/Utils"; import TelemetryReporter from "@vscode/extension-telemetry"; -import { CopilotNotificationDoNotShowChecked, CopilotTryNotificationClickedEvent, CopilotNotificationDoNotShowUnchecked } from "../telemetry/telemetryConstants"; -import { COPILOT_IN_POWERPAGES, COPILOT_NOTIFICATION_DISABLED } from "../constants"; +import { CopilotNotificationDoNotShowChecked, CopilotTryNotificationClickedEvent, CopilotNotificationDoNotShowUnchecked, CopilotNotificationTryGitHubCopilotClicked } from "../telemetry/telemetryConstants"; +import { COPILOT_IN_POWERPAGES, COPILOT_NOTIFICATION_DISABLED, PowerPagesParticipantDocLink, PowerPagesParticipantPrompt } from "../constants"; import { oneDSLoggerWrapper } from "../../OneDSLoggerTelemetry/oneDSLoggerWrapper"; let NotificationPanel: vscode.WebviewPanel | undefined; @@ -56,12 +56,12 @@ export async function copilotNotificationPanel(context: vscode.ExtensionContext, NotificationPanel?.dispose(); break; case 'learnMore': - // telemetry.sendTelemetryEvent(CopilotWalkthroughEvent, { listOfOrgs: telemetryData, countOfActivePortals: countOfActivePortals as string }); - // openWalkthrough(context.extensionUri); + telemetry.sendTelemetryEvent(CopilotNotificationTryGitHubCopilotClicked, { listOfOrgs: telemetryData, countOfActivePortals: countOfActivePortals as string }); + oneDSLoggerWrapper.getLogger().traceInfo(CopilotNotificationTryGitHubCopilotClicked, { listOfOrgs: telemetryData, countOfActivePortals: countOfActivePortals as string }); if (isGitHubCopilotPresent) { - vscode.commands.executeCommand('workbench.action.chat.open', '@powerpages how can you help with coding for my website?'); + vscode.commands.executeCommand('workbench.action.chat.open', PowerPagesParticipantPrompt); } else { - vscode.env.openExternal(vscode.Uri.parse('https://go.microsoft.com/fwlink/?linkid=2276973')); + vscode.env.openExternal(vscode.Uri.parse(PowerPagesParticipantDocLink)); } } },