From 926df6ae5f3bbd508e12bc8058326d48c5046d62 Mon Sep 17 00:00:00 2001 From: amitjoshi Date: Mon, 16 Dec 2024 12:23:11 +0530 Subject: [PATCH] [PowerPages] Update localization strings for site creation and improve error handling --- l10n/bundle.l10n.json | 55 ++++++++++--------- .../vscode-powerplatform.xlf | 15 ++++- .../PowerPagesChatParticipantUtils.ts | 1 + .../commands/create-site/CreateSiteHelper.ts | 5 ++ .../commands/create-site/CreateSiteModel.ts | 1 + .../commands/create-site/CreateSiteUtils.ts | 1 + 6 files changed, 49 insertions(+), 29 deletions(-) diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 36ca2d22..0f3efdf9 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -83,40 +83,18 @@ "Hi! Power Pages lets you build secure, professional websites that you can quickly configure and publish across web browsers and devices.\n\nTo create your website, visit the [Power Pages](https://powerpages.microsoft.com/).\nReturn to this chat and @powerpages can help you write and edit your website code.": "Hi! Power Pages lets you build secure, professional websites that you can quickly configure and publish across web browsers and devices.\n\nTo create your website, visit the [Power Pages](https://powerpages.microsoft.com/).\nReturn to this chat and @powerpages can help you write and edit your website code.", "Checking for active auth profile...": "Checking for active auth profile...", "@PowerPages is not yet available in your region.": "@PowerPages is not yet available in your region.", - "Failed to get site content from NL2Site service": "Failed to get site content from NL2Site service", "Generating webpages...": "Generating webpages...", "Generating a new Power Pages site...": "Generating a new Power Pages site...", + "Failed to create a new Power Pages site. Please try again.": "Failed to create a new Power Pages site. Please try again.", + "Creating Site Records": "Creating Site Records", + "Initializing site manager...": "Initializing site manager...", + "Saving site...": "Saving site...", "Select Folder for new PCF Control/Do not translate 'PCF' as it is a product name.": { "message": "Select Folder for new PCF Control", "comment": [ "Do not translate 'PCF' as it is a product name." ] }, - "Preparing pac CLI (v{0}).../{0} represents the version number": { - "message": "Preparing pac CLI (v{0})...", - "comment": [ - "{0} represents the version number" - ] - }, - "The pac CLI is ready for use in your VS Code terminal!": "The pac CLI is ready for use in your VS Code terminal!", - "Cannot install pac CLI: {0}/{0} represents the error message returned from the exception": { - "message": "Cannot install pac CLI: {0}", - "comment": [ - "{0} represents the error message returned from the exception" - ] - }, - "Installing Power Pages generator(v{0}).../{0} represents the version number": { - "message": "Installing Power Pages generator(v{0})...", - "comment": [ - "{0} represents the version number" - ] - }, - "dotnet sdk 6.0 or greater must be installed/Do not translate 'dotnet' or 'sdk'": { - "message": "dotnet sdk 6.0 or greater must be installed", - "comment": [ - "Do not translate 'dotnet' or 'sdk'" - ] - }, "File might be referenced by name {0} here./{0} represents the name of the file": { "message": "File might be referenced by name {0} here.", "comment": [ @@ -188,6 +166,12 @@ "Do not translate 'npm'" ] }, + "Installing Power Pages generator(v{0}).../{0} represents the version number": { + "message": "Installing Power Pages generator(v{0})...", + "comment": [ + "{0} represents the version number" + ] + }, "Cannot install Power Pages generator: {0}/{0} represents the error message returned from the exception": { "message": "Cannot install Power Pages generator: {0}", "comment": [ @@ -217,6 +201,25 @@ "The {3} represents Dataverse Environment's Organization ID (GUID)" ] }, + "Preparing pac CLI (v{0}).../{0} represents the version number": { + "message": "Preparing pac CLI (v{0})...", + "comment": [ + "{0} represents the version number" + ] + }, + "The pac CLI is ready for use in your VS Code terminal!": "The pac CLI is ready for use in your VS Code terminal!", + "Cannot install pac CLI: {0}/{0} represents the error message returned from the exception": { + "message": "Cannot install pac CLI: {0}", + "comment": [ + "{0} represents the error message returned from the exception" + ] + }, + "dotnet sdk 6.0 or greater must be installed/Do not translate 'dotnet' or 'sdk'": { + "message": "dotnet sdk 6.0 or greater must be installed", + "comment": [ + "Do not translate 'dotnet' or 'sdk'" + ] + }, "Confirm": "Confirm", "Are you sure you want to clear all the Auth Profiles?": "Are you sure you want to clear all the Auth Profiles?", "Cancel": "Cancel", diff --git a/loc/translations-export/vscode-powerplatform.xlf b/loc/translations-export/vscode-powerplatform.xlf index 5cba25db..153f2f7c 100644 --- a/loc/translations-export/vscode-powerplatform.xlf +++ b/loc/translations-export/vscode-powerplatform.xlf @@ -97,6 +97,9 @@ Copy to clipboard + + Creating Site Records + Creating {0}... {0} will be replaced by the entity type. @@ -143,6 +146,9 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca Explain the following code {% include 'Page Copy'%} + + Failed to create a new Power Pages site. Please try again. + Failed to create: {0}. {0} will be replaced by the error message. @@ -159,9 +165,6 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca Failed to get file ready for edit: {0} - - Failed to get site content from NL2Site service - Feature is not enabled for this geo. @@ -214,6 +217,9 @@ Return to this chat and @powerpages can help you write and edit your website cod In your own words, describe what you need. You can get help with writing code for Power Pages sites in HTML, CSS, and JS languages. + + Initializing site manager... + Insert code into editor @@ -357,6 +363,9 @@ The {3} represents Dataverse Environment's Organization ID (GUID) Response data is empty + + Saving site... + Saving your file ... diff --git a/src/common/chat-participants/powerpages/PowerPagesChatParticipantUtils.ts b/src/common/chat-participants/powerpages/PowerPagesChatParticipantUtils.ts index c7e8539a..f790530e 100644 --- a/src/common/chat-participants/powerpages/PowerPagesChatParticipantUtils.ts +++ b/src/common/chat-participants/powerpages/PowerPagesChatParticipantUtils.ts @@ -135,6 +135,7 @@ export function registerButtonCommands() { vscode.commands.registerCommand(CREATE_SITE_BTN_CMD, async ({ siteName, sitePages, sitePagesList, envList, contentProvider, telemetry, isCreateSiteInputsReceived }: ICreateSiteCommandArgs) => { if (!isCreateSiteInputsReceived) { // Update Page Content will be used for the site creation + // eslint-disable-next-line @typescript-eslint/no-explicit-any const updatedPages = sitePages.map((page: any) => { return { ...page, diff --git a/src/common/chat-participants/powerpages/commands/create-site/CreateSiteHelper.ts b/src/common/chat-participants/powerpages/commands/create-site/CreateSiteHelper.ts index 59b9e91d..7e3b0877 100644 --- a/src/common/chat-participants/powerpages/commands/create-site/CreateSiteHelper.ts +++ b/src/common/chat-participants/powerpages/commands/create-site/CreateSiteHelper.ts @@ -110,6 +110,7 @@ function previewSitePagesContent( try { const sitePagesContent: { name: string; content: string }[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any sitePages.forEach((page: any) => { sitePagesContent.push({ name: page.metadata.pageTitle, content: page.code }); }); @@ -198,6 +199,7 @@ export async function collectSiteCreationInputs(siteName: string, envList: IEnvI } +// eslint-disable-next-line @typescript-eslint/no-explicit-any export async function populateSiteRecords(siteName: string, sitePagesList: string[], sitePages: any, orgUrl: string, telemetry: ITelemetry) { return vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, @@ -240,7 +242,9 @@ export async function populateSiteRecords(siteName: string, sitePagesList: strin } +// eslint-disable-next-line @typescript-eslint/no-explicit-any function createSitePagesMap(sitePagesList: string[], sitePages: any): Record { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return sitePagesList.reduce((acc: Record, pageName: string, index: number) => { acc[pageName] = sitePages[index]; return acc; @@ -248,6 +252,7 @@ function createSitePagesMap(sitePagesList: string[], sitePages: any): Record, siteManager: PowerPagesSiteManager): Promise { const { actions } = siteManager.getSiteDataAndActions(); const promises = Object.entries(sitePagesMap).map(([pageName, pageContent]) => { diff --git a/src/common/chat-participants/powerpages/commands/create-site/CreateSiteModel.ts b/src/common/chat-participants/powerpages/commands/create-site/CreateSiteModel.ts index c66caa7a..5e663c73 100644 --- a/src/common/chat-participants/powerpages/commands/create-site/CreateSiteModel.ts +++ b/src/common/chat-participants/powerpages/commands/create-site/CreateSiteModel.ts @@ -127,6 +127,7 @@ export interface ISiteInputState { export interface ICreateSiteCommandArgs { siteName: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any sitePages: any[]; sitePagesList: string[]; envList: IEnvInfo[]; diff --git a/src/common/chat-participants/powerpages/commands/create-site/CreateSiteUtils.ts b/src/common/chat-participants/powerpages/commands/create-site/CreateSiteUtils.ts index f9b64749..23de499f 100644 --- a/src/common/chat-participants/powerpages/commands/create-site/CreateSiteUtils.ts +++ b/src/common/chat-participants/powerpages/commands/create-site/CreateSiteUtils.ts @@ -155,6 +155,7 @@ export const getFileUploadHeaders = (fileName: string, dataverseToken: string) = }; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any export function createHttpRequestOptions(method: string, url: string, body: any, headers?: Record): any { return { method,