Skip to content

Commit

Permalink
Merge branch 'users/nityagi/CompleteNavigationLoop' of https://github…
Browse files Browse the repository at this point in the history
….com/microsoft/powerplatform-vscode into users/nityagi/CompleteNavigationLoop
  • Loading branch information
tyaginidhi committed Sep 29, 2023
2 parents d07a5a7 + 612ce1d commit c538bc5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@
"category": "Copilot In Power Pages",
"title": "Clear Conversation",
"icon": "$(clear-all)"
},
{
"command": "powerpages.copilot.explain",
"category": "Copilot In Power Pages",
"title": "Explain"
}
],
"configuration": {
Expand Down Expand Up @@ -567,6 +572,19 @@
}
],
"menus": {
"editor/context": [
{
"submenu": "microsoft-powerapps-portals.powerpages-copilot",
"group": "0_powerpages-copilot",
"when": "never"
}
],
"microsoft-powerapps-portals.powerpages-copilot": [
{
"command": "powerpages.copilot.explain",
"group": "0_powerpages-copilot@1"
}
],
"explorer/context": [
{
"submenu": "microsoft-powerapps-portals.powerpages",
Expand Down Expand Up @@ -721,6 +739,10 @@
"command": "powerpages.copilot.clearConversation",
"when": "never"
},
{
"command": "powerpages.copilot.explain",
"when": "never"
},
{
"command": "microsoft-powerapps-portals.webpage",
"when": "config.powerPlatform.generatorInstalled"
Expand Down Expand Up @@ -834,6 +856,10 @@
{
"id": "microsoft-powerapps-portals.powerpages",
"label": "Power Pages"
},
{
"id": "microsoft-powerapps-portals.powerpages-copilot",
"label": "Copilot In Power Pages"
}
],
"viewsContainers": {
Expand Down
11 changes: 8 additions & 3 deletions src/common/copilot/PowerPagesCopilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,21 @@ export class PowerPagesCopilot implements vscode.WebviewViewProvider {
const pacOutput = await this._pacWrapper?.activeOrg();

if (pacOutput && pacOutput.Status === PAC_SUCCESS) {
this.handleOrgChangeSuccess(pacOutput.Results);
await this.handleOrgChangeSuccess(pacOutput.Results);
} else if (!IS_DESKTOP && orgID && activeOrgUrl) {
this.handleOrgChangeSuccess({ OrgId: orgID, UserId: userID, OrgUrl: activeOrgUrl } as ActiveOrgOutput);
await this.handleOrgChangeSuccess({ OrgId: orgID, UserId: userID, OrgUrl: activeOrgUrl } as ActiveOrgOutput);
}

webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);

webviewView.webview.onDidReceiveMessage(async (data) => {
switch (data.type) {
case "webViewLoaded": {
if (this.aibEndpoint === COPILOT_UNAVAILABLE) {
this.sendMessageToWebview({ type: 'Unavailable' });
return;
}

sendTelemetryEvent(this.telemetry, { eventName: CopilotLoadedEvent, copilotSessionId: sessionID, orgId: orgID });
this.sendMessageToWebview({ type: 'env' }); //TODO Use IS_DESKTOP
await this.checkAuthentication();
Expand Down Expand Up @@ -327,7 +332,7 @@ export class PowerPagesCopilot implements vscode.WebviewViewProvider {

this.aibEndpoint = await getIntelligenceEndpoint(orgID, this.telemetry, sessionID);
if (this.aibEndpoint === COPILOT_UNAVAILABLE) {
sendTelemetryEvent(this.telemetry, {eventName: CopilotNotAvailable, copilotSessionId: sessionID, orgId: orgID});
sendTelemetryEvent(this.telemetry, { eventName: CopilotNotAvailable, copilotSessionId: sessionID, orgId: orgID });
this.sendMessageToWebview({ type: 'Unavailable' });
} else {
this.sendMessageToWebview({ type: 'Available' });
Expand Down

0 comments on commit c538bc5

Please sign in to comment.