Skip to content

Commit

Permalink
Merge branch 'main' into users/nityagi/CompleteNavigationLoop
Browse files Browse the repository at this point in the history
  • Loading branch information
tyaginidhi committed Sep 26, 2023
2 parents 5cc2f13 + 349a78d commit 649beb8
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 29 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Installing this extension will also make the latest Power Platform CLI (aka pac)
[Power Platform CLI Exposed](https://www.youtube.com/playlist?list=PLlrxD0HtieHhEdLHxQOU96ySSZpMCyAxf)

## Release Notes

2.0.10:
- pac CLI 1.27.5 (Auguest refresh, see release notes on [nuget.org](https://www.nuget.org/packages/Microsoft.PowerApps.CLI/))
- (Preview) Added 'Copilot in Power Pages' to Web Extension

2.0.7:
- QFE for styling files load for new data model schema

Expand Down
2 changes: 1 addition & 1 deletion gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ async function snapshot() {
}

const feedName = 'CAP_ISVExp_Tools_Stable';
const cliVersion = '1.26.6';
const cliVersion = '1.27.5';

const recompile = gulp.series(
clean,
Expand Down
1 change: 1 addition & 0 deletions l10n/bundle.l10n.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"Profile Kind: {0}/The {0} represents the profile type (Admin vs Dataverse)": "Profil-Variante: {0}",
"Resource: {0}/The {0} represents profile's resource/environment URL": "Ressource: {0}",
"Saving your file ...": "Datei wird gespeichert ...",
"Select Folder for new PCF Control/Do not translate 'PCF' as it is a product name.": "Ordner für neues PCF-Steuerelement auswählen",
"Select Type": "Typ auswählen",
"The Power Pages generator is ready for use in your VS Code extension!": "Der Power Pages-Generator ist in Ihrer VS Code-Erweiterung zur Verwendung bereit!",
"The name you want to give to this authentication profile": "Der Name, den Sie diesem Authentifizierungsprofil geben möchten",
Expand Down
1 change: 1 addition & 0 deletions l10n/bundle.l10n.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"Profile Kind: {0}/The {0} represents the profile type (Admin vs Dataverse)": "Type de profil : {0}",
"Resource: {0}/The {0} represents profile's resource/environment URL": "Ressource : {0}",
"Saving your file ...": "Enregistrement de votre fichier en cours...",
"Select Folder for new PCF Control/Do not translate 'PCF' as it is a product name.": "Sélectionner un dossier pour le nouveau contrôle PCF",
"Select Type": "Sélectionner le type",
"The Power Pages generator is ready for use in your VS Code extension!": "Le générateur Power Pages est prêt à être utilisé dans votre extension VS Code !",
"The name you want to give to this authentication profile": "Nom que vous souhaitez attribuer à ce profil d’authentification",
Expand Down
1 change: 1 addition & 0 deletions l10n/bundle.l10n.it.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"Profile Kind: {0}/The {0} represents the profile type (Admin vs Dataverse)": "Tipo di profilo: {0}",
"Resource: {0}/The {0} represents profile's resource/environment URL": "Risorsa: {0}",
"Saving your file ...": "Salvataggio del file in corso...",
"Select Folder for new PCF Control/Do not translate 'PCF' as it is a product name.": "Seleziona cartella per nuovo controllo PCF",
"Select Type": "Seleziona tipo",
"The Power Pages generator is ready for use in your VS Code extension!": "Il generatore Power Pages è pronto per l'utilizzo nell'estensione VS Code.",
"The name you want to give to this authentication profile": "Il nome che vuoi assegnare a questo profilo di autenticazione",
Expand Down
10 changes: 5 additions & 5 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"Edit the site": "Edit the site",
"Be careful making changes. Anyone can see the changes you make immediately. Choose Edit the site to make edits, or close the editor tab to cancel without editing.": "Be careful making changes. Anyone can see the changes you make immediately. Choose Edit the site to make edits, or close the editor tab to cancel without editing.",
"You are editing a live, public site ": "You are editing a live, public site ",
"Get help writing code in HTML, CSS, and JS languages for Power Pages sites with Copilot.": "Get help writing code in HTML, CSS, and JS languages for Power Pages sites with Copilot.",
"Try Copilot for Power Pages": "Try Copilot for Power Pages",
"Microsoft wants your feeback": "Microsoft wants your feeback",
"Check the URL and verify the parameters are correct": "Check the URL and verify the parameters are correct",
"Unable to complete the request": "Unable to complete the request",
Expand Down Expand Up @@ -33,8 +35,6 @@
"Do not translate 'PCF' as it is a product name."
]
},
"Get help writing code in HTML, CSS, and JS languages for Power Pages sites with Copilot.": "Get help writing code in HTML, CSS, and JS languages for Power Pages sites with Copilot.",
"Try Copilot for Power Pages": "Try Copilot for Power Pages",
"Preparing pac CLI (v{0}).../{0} represents the version number": {
"message": "Preparing pac CLI (v{0})...",
"comment": [
Expand Down Expand Up @@ -66,6 +66,9 @@
"{0} represents the name of the file"
]
},
"Enter the name of the web template": "Enter the name of the web template",
"Please enter a name for the web template.": "Please enter a name for the web template.",
"A webtemplate with the same name already exists. Please enter a different name.": "A webtemplate with the same name already exists. Please enter a different name.",
"No page templates found": "No page templates found",
"No webpages found": "No webpages found",
"New Webpage": "New Webpage",
Expand All @@ -78,9 +81,6 @@
"File(s) already exist. No new files to add": "File(s) already exist. No new files to add",
"Web files": "Web files",
"Webfile(s) added successfully": "Webfile(s) added successfully",
"Enter the name of the web template": "Enter the name of the web template",
"Please enter a name for the web template.": "Please enter a name for the web template.",
"A webtemplate with the same name already exists. Please enter a different name.": "A webtemplate with the same name already exists. Please enter a different name.",
"Page Template name cannot be empty.": "Page Template name cannot be empty.",
"New Page Template": "New Page Template",
"Choose web template": "Choose web template",
Expand Down
1 change: 1 addition & 0 deletions l10n/bundle.l10n.tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"Profile Kind: {0}/The {0} represents the profile type (Admin vs Dataverse)": "Profil Türü: {0}",
"Resource: {0}/The {0} represents profile's resource/environment URL": "Kaynak: {0}",
"Saving your file ...": "Dosyanız kaydediliyor...",
"Select Folder for new PCF Control/Do not translate 'PCF' as it is a product name.": "Yeni PCF Denetimi için Klasör Seçin",
"Select Type": "Tür Seç",
"The Power Pages generator is ready for use in your VS Code extension!": "Power Pages oluşturucusu, VS Code uzantınızda kullanıma hazır!",
"The name you want to give to this authentication profile": "Bu kimlik doğrulama profiline vermek istediğiniz ad",
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@
"moment": "^2.29.4",
"node-fetch": "^2.6.7",
"nyc": "^15.1.0",
"nanoid": "^3.1.31",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
Expand Down
9 changes: 5 additions & 4 deletions src/common/copilot/PowerPagesCopilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { escapeDollarSign, getLastThreePartsOfFileName, getNonce, getUserName, o
import { CESUserFeedback } from "./user-feedback/CESSurvey";
import { GetAuthProfileWatchPattern } from "../../client/lib/AuthPanelView";
import { ActiveOrgOutput } from "../../client/pac/PacTypes";
import { CopilotWalkthroughEvent, CopilotCopyCodeToClipboardEvent, CopilotInsertCodeToEditorEvent, CopilotLoadedEvent, CopilotOrgChangedEvent, CopilotUserFeedbackThumbsDownEvent, CopilotUserFeedbackThumbsUpEvent, CopilotUserPromptedEvent, CopilotCodeLineCountEvent, CopilotClearChatEvent } from "./telemetry/telemetryConstants";
import { CopilotWalkthroughEvent, CopilotCopyCodeToClipboardEvent, CopilotInsertCodeToEditorEvent, CopilotLoadedEvent, CopilotOrgChangedEvent, CopilotUserFeedbackThumbsDownEvent, CopilotUserFeedbackThumbsUpEvent, CopilotUserPromptedEvent, CopilotCodeLineCountEvent, CopilotClearChatEvent, CopilotNotAvailable } from "./telemetry/telemetryConstants";
import { sendTelemetryEvent } from "./telemetry/copilotTelemetry";
import { INTELLIGENCE_SCOPE_DEFAULT, PROVIDER_ID } from "../../web/client/common/constants";
import { getIntelligenceEndpoint } from "../ArtemisService";
Expand Down Expand Up @@ -243,7 +243,7 @@ export class PowerPagesCopilot implements vscode.WebviewViewProvider {
if (pacOutput && pacOutput.Status === PAC_SUCCESS) {
this.handleOrgChangeSuccess.call(this, pacOutput.Results);

intelligenceAPIAuthentication(this.telemetry, sessionID).then(({ accessToken, user, userId }) => {
intelligenceAPIAuthentication(this.telemetry, sessionID, orgID).then(({ accessToken, user, userId }) => {
this.intelligenceAPIAuthenticationHandler.call(this, accessToken, user, userId);
});

Expand All @@ -262,7 +262,7 @@ export class PowerPagesCopilot implements vscode.WebviewViewProvider {
}
const pacAuthCreateOutput = await showProgressWithNotification(AUTH_CREATE_MESSAGE, async () => { return await this._pacWrapper?.authCreateNewAuthProfileForOrg(userOrgUrl) });
pacAuthCreateOutput && pacAuthCreateOutput.Status === PAC_SUCCESS
? intelligenceAPIAuthentication(this.telemetry, sessionID).then(({ accessToken, user, userId }) =>
? intelligenceAPIAuthentication(this.telemetry, sessionID, orgID).then(({ accessToken, user, userId }) =>
this.intelligenceAPIAuthenticationHandler.call(this, accessToken, user, userId)
)
: vscode.window.showErrorMessage(AUTH_CREATE_FAILED);
Expand All @@ -285,7 +285,7 @@ export class PowerPagesCopilot implements vscode.WebviewViewProvider {
}

private async authenticateAndSendAPIRequest(data: string, activeFileParams: IActiveFileParams, orgID: string, telemetry: ITelemetry) {
return intelligenceAPIAuthentication(telemetry, sessionID)
return intelligenceAPIAuthentication(telemetry, sessionID, orgID)
.then(async ({ accessToken, user, userId }) => {
intelligenceApiToken = accessToken;
userName = getUserName(user);
Expand Down Expand Up @@ -327,6 +327,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});
this.sendMessageToWebview({ type: 'Unavailable' });
} else {
this.sendMessageToWebview({ type: 'Available' });
Expand Down
6 changes: 6 additions & 0 deletions src/common/copilot/assets/scripts/copilot.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,23 @@

suggestedPrompt.innerHTML = `<p class="suggested-title">Here are a few suggestions to get you started</p>
<a href='#' class="suggested-prompt">
<span class="icon-container">
${starIconSvg}
</span>
${formPrompt}
</a>
<br>
<a href='#' class="suggested-prompt">
<span class="icon-container">
${starIconSvg}
</span>
${webApiPrompt}
</a>
<br>
<a href='#' class="suggested-prompt">
<span class="icon-container">
${starIconSvg}
</span>
${listPrompt}
</a>`;

Expand Down
19 changes: 12 additions & 7 deletions src/common/copilot/assets/styles/copilot.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ body {
.disclaimer {
margin: 0px;
margin-top: 12px;
color: var(--vscode-titleBar-inactiveForeground);
font-size: 12px;
}

.send-icon,
Expand All @@ -96,12 +98,12 @@ body {

.user-message {
padding: 12px;
background-color: var(--vscode-editor-background);
background-color: var(--vscode-sideBar-background);
}

.api-response {
padding: 12px;
background-color: var(--vscode-sideBar-background);
background-color: var(--vscode-editor-background);
}

.message {
Expand Down Expand Up @@ -153,7 +155,7 @@ body {
padding: 20px 5px 1px 10px;
margin: 10px 0px;
border-radius: 4px;
background-color: var(--vscode-editor-background);
background-color: var(--vscode-sideBar-background)

}

Expand Down Expand Up @@ -234,11 +236,12 @@ li:before {
align-items: center;
justify-content: space-between;
padding: 6px 20px 12px 20px;
background-color: var(--vscode-sideBar-background);
background-color: var(--vscode-editor-background);
}

.feedback-statement {
margin: 0 10px 0 0;
font-size: 11px;
}

.feedback-icons {
Expand Down Expand Up @@ -305,6 +308,8 @@ hr {
margin: 16px 0px;
}

.star-icon {
margin-right: 4px;
}

.icon-container {
width: 14px; /* Set a fixed width for the icon */
margin-right: 4px; /* Add some spacing between icon and text */
}
5 changes: 3 additions & 2 deletions src/common/copilot/telemetry/telemetryConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ export const CopilotResponseOkFailureEvent = 'CopilotResponseOkFailureEvent';
export const CopilotResponseFailureEventWithMessage = 'CopilotResponseFailureEventWithMessage';
export const CopilotCodeLineCountEvent = 'CopilotCodeLineCountEvent';
export const CopilotNotificationShown = 'CopilotNotificationShown';
export const CopilotNotificationDoNotShowChecked = 'CopilotNotificationDoNotShowChecked'
export const CopilotNotificationDoNotShowUnchecked = 'CopilotNotificationDoNotShowUnchecked'
export const CopilotNotificationDoNotShowChecked = 'CopilotNotificationDoNotShowChecked';
export const CopilotNotificationDoNotShowUnchecked = 'CopilotNotificationDoNotShowUnchecked';
export const CopilotNotAvailable = 'CopilotNotAvailable';
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ function getWebviewContent(notificationCssUri: vscode.Uri, notificationJsUri: vs
<button id="try-button">Try Copilot for Power Pages</button>
<a href="#" class="walkthrough-content" id="walkthroughLink"> <span id="walk-text">Learn more about Copilot </span> <img src="${arrowImageUri}" id="arrow-icon"> </a>
</div>
<div>
<img src="${copilotImageUri}" alt="Image">
</div>
</div>
<div class="checkbox-container">
<input type="checkbox" id="checkbox">
Expand Down
15 changes: 8 additions & 7 deletions src/common/copilot/welcome-notification/copilotNotification.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ body {
/* flex-direction: column; */
align-items: center;
justify-content: space-between;
margin-left: 32px;
margin-right: 32px;
margin-top: 159px;
margin-left: 2rem;
margin-right: 2rem;
margin-top: 2rem;
}

.container-text {
Expand All @@ -26,14 +26,15 @@ body {
}

/* Media query for smaller screens */
@media (max-width: 650px) {
@media (max-width: 450px) {
.container {
flex-direction: column; /* Stack elements on top of each other */
align-items: center;
margin-top: 3rem;
}

.container-text {
margin-right: 0; /* Remove margin for smaller screens */
margin: 0rem 3rem;
}

}
Expand Down Expand Up @@ -65,7 +66,7 @@ button {

.walkthrough-content {
padding: 6px 0px 6px 0px;
margin-bottom: 68px;
margin-bottom: 0px;
text-decoration: none;
display: block;
align-items: center;
Expand All @@ -77,7 +78,7 @@ button {
align-items: center;
justify-content: center;
margin-bottom: 30px;
margin-top: 180px;
margin-top: 3rem;
}

#arrow-icon {
Expand Down
6 changes: 3 additions & 3 deletions src/web/client/common/authenticationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function getCommonHeaders(
}

//Get access token for Intelligence API service
export async function intelligenceAPIAuthentication(telemetry: ITelemetry, sessionID: string, firstTimeAuth = false): Promise<{ accessToken: string, user: string, userId: string }> {
export async function intelligenceAPIAuthentication(telemetry: ITelemetry, sessionID: string, orgId: string, firstTimeAuth = false): Promise<{ accessToken: string, user: string, userId: string }> {
let accessToken = '';
let user = '';
let userId = '';
Expand All @@ -54,13 +54,13 @@ export async function intelligenceAPIAuthentication(telemetry: ITelemetry, sessi
}

if (firstTimeAuth) {
sendTelemetryEvent(telemetry, { eventName: CopilotLoginSuccessEvent, copilotSessionId: sessionID });
sendTelemetryEvent(telemetry, { eventName: CopilotLoginSuccessEvent, copilotSessionId: sessionID, orgId: orgId });
}
} catch (error) {
const authError = (error as Error)
showErrorDialog(vscode.l10n.t("Authorization Failed. Please run again to authorize it"),
vscode.l10n.t("There was a permissions problem with the server"));
sendTelemetryEvent(telemetry, { eventName: CopilotLoginFailureEvent, copilotSessionId: sessionID, error: authError });
sendTelemetryEvent(telemetry, { eventName: CopilotLoginFailureEvent, copilotSessionId: sessionID, orgId: orgId, error: authError });
}
return { accessToken, user, userId };
}
Expand Down

0 comments on commit 649beb8

Please sign in to comment.