Skip to content

Commit

Permalink
Add sovereign cloud endpoints for PPAPI service (#1081)
Browse files Browse the repository at this point in the history
  • Loading branch information
priyanshu92 authored Jan 16, 2025
1 parent 8c7d844 commit a82f277
Show file tree
Hide file tree
Showing 12 changed files with 313 additions and 165 deletions.
21 changes: 16 additions & 5 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
},
"Enter the environment URL": "Enter the environment URL",
"Active auth profile is not found or has expired. To create a new auth profile, enter the environment URL.": "Active auth profile is not found or has expired. To create a new auth profile, enter the environment URL.",
"Website not found in the environment. Please check the credentials and root folder path.": "Website not found in the environment. Please check the credentials and root folder path.",
"Selection is empty.": "Selection is empty.",
"PREVIEW": "PREVIEW",
"Explain the following code snippet:": "Explain the following code snippet:",
Expand Down Expand Up @@ -93,13 +92,25 @@
"Do not translate 'PCF' as it is a product name."
]
},
"The extension Microsoft Edge Tools is required to run this command. Do you want to install it now?": "The extension Microsoft Edge Tools is required to run this command. Do you want to install it now?",
"Install": "Install",
"Cancel": "Cancel",
"Install": "Install",
"The extension 'Microsoft Edge Tools' is required to run this command. Do you want to install it now?/Do not translate 'Microsoft Edge Tools' ": {
"message": "The extension 'Microsoft Edge Tools' is required to run this command. Do you want to install it now?",
"comment": [
"Do not translate 'Microsoft Edge Tools' "
]
},
"Opening site preview...": "Opening site preview...",
"The preview shown is for published changes.": "The preview shown is for published changes.",
"Site runtime preview feature is not enabled.": "Site runtime preview feature is not enabled.",
"No workspace folder opened. Please open a site folder to preview.": "No workspace folder opened. Please open a site folder to preview.",
"Website URL not found.": "Website URL not found.",
"Opening site preview...": "Opening site preview...",
"Initializing site preview. Please try again after few seconds.": "Initializing site preview. Please try again after few seconds.",
"Website not found in the environment. Please check the credentials and login with correct account.": "Website not found in the environment. Please check the credentials and login with correct account.",
"Initializing site preview": "Initializing site preview",
"Getting organization details...": "Getting organization details...",
"Getting region information...": "Getting region information...",
"Failed to get website endpoint. Please try again later": "Failed to get website endpoint. Please try again later",
"Getting website endpoint...": "Getting website endpoint...",
"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": [
Expand Down
33 changes: 26 additions & 7 deletions loc/translations-export/vscode-powerplatform.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca
<trans-unit id="++CODE++862d6197d64601aa13ce30db5ec5b8f819ad00fe21e3b031a3e47fe22ef68fb3">
<source xml:lang="en">Failed to get file ready for edit: {0}</source>
</trans-unit>
<trans-unit id="++CODE++51e1f5c5757cfd25a390293a7d8e9eb583943b66211fae1cbe25d07bfcb767f1">
<source xml:lang="en">Failed to get website endpoint. Please try again later</source>
</trans-unit>
<trans-unit id="++CODE++a9e36b880dd45b64ae5601865540605296febf9bd855fc46d9c35c2c2ed9a7f2">
<source xml:lang="en">Feature is not enabled for this geo.</source>
</trans-unit>
Expand Down Expand Up @@ -190,6 +193,15 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca
<trans-unit id="++CODE++ee1d3100df4b00eabd74481b92106e42cce956213372a914082f82702f56470d">
<source xml:lang="en">Get GitHub Copilot to try @powerpages</source>
</trans-unit>
<trans-unit id="++CODE++1a1075387e5e1674a11f58f6aadd4e0abc63e1e3d201ae980b12a37e6d5a584b">
<source xml:lang="en">Getting organization details...</source>
</trans-unit>
<trans-unit id="++CODE++6f1bba10af9069a03da80d629b97c40fc4bedaf90a23496a2bdef0c512a92959">
<source xml:lang="en">Getting region information...</source>
</trans-unit>
<trans-unit id="++CODE++0087988cdb71080f2525354e125366c6db7d85a36f199e2f80d14a44b3fd0340">
<source xml:lang="en">Getting website endpoint...</source>
</trans-unit>
<trans-unit id="++CODE++b9f4adbdfa2deef1eaa415a914f63329ee06c604b5a1bf34645175b9e28a9712">
<source xml:lang="en">Here are a few suggestions to get you started</source>
</trans-unit>
Expand All @@ -214,6 +226,12 @@ Return to this chat and @powerpages can help you write and edit your website cod
<trans-unit id="++CODE++08295f3385931e35c850b945e2ae04882452c4bf0dd575f70e95aaa6ed00daa9">
<source xml:lang="en">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.</source>
</trans-unit>
<trans-unit id="++CODE++a22418694e3938cc42976630bcd24822ed4f671b168708e0641171440ca8f6dd">
<source xml:lang="en">Initializing site preview</source>
</trans-unit>
<trans-unit id="++CODE++15b09c32b0337229ff64c72f2ea9a3f8422fa20975ae494da863fd738554b1de">
<source xml:lang="en">Initializing site preview. Please try again after few seconds.</source>
</trans-unit>
<trans-unit id="++CODE++e992151b1efc99f93484c7d7f3076b66ab072a8af2383e96104cc597c971339c">
<source xml:lang="en">Insert code into editor</source>
</trans-unit>
Expand Down Expand Up @@ -403,15 +421,19 @@ The {3} represents Dataverse Environment's Organization ID (GUID)</note>
<trans-unit id="++CODE++618f7afd7be2f12bf2ebbaba5bc7e951d2ebfb11d4480647f991fbb664caa26e">
<source xml:lang="en">The Power Pages generator is ready for use in your VS Code extension!</source>
</trans-unit>
<trans-unit id="++CODE++538ecf1398703f8a2048b99a2b2a533012b06ee88d67a0fd6fbbcd716cfbd663">
<source xml:lang="en">The extension Microsoft Edge Tools is required to run this command. Do you want to install it now?</source>
<trans-unit id="++CODE++0bc2e4918b64f82220bde3dae30dc007a45fb59c3677833fb5a0e275a3b6b54b">
<source xml:lang="en">The extension 'Microsoft Edge Tools' is required to run this command. Do you want to install it now?</source>
<note>Do not translate 'Microsoft Edge Tools' </note>
</trans-unit>
<trans-unit id="++CODE++e4a2396fd7a366292a40abc87b18a2329458c258f4d0e0e593e6189dff19a117">
<source xml:lang="en">The name you want to give to this authentication profile</source>
</trans-unit>
<trans-unit id="++CODE++5eccedc8c04d2137a9eb74edf18ea469b4b63e7315de4b8fe49c48bb8d0780e9">
<source xml:lang="en">The pac CLI is ready for use in your VS Code terminal!</source>
</trans-unit>
<trans-unit id="++CODE++db00163e0e6fed2e319e28785c537befb88ded272d245e503d9580322ab2fec8">
<source xml:lang="en">The preview shown is for published changes.</source>
</trans-unit>
<trans-unit id="++CODE++18f3be2933741b96e56b1e1f70818fcba46ec9c5b3dcd0e28d801eab15791d84">
<source xml:lang="en">There was a permissions problem with the server</source>
</trans-unit>
Expand Down Expand Up @@ -464,11 +486,8 @@ The {3} represents Dataverse Environment's Organization ID (GUID)</note>
<trans-unit id="++CODE++00dc171124ab430bbbaae51ec39dda1c5e7d045f382f56b1767d9e733292731c">
<source xml:lang="en">Webpage names should contain only letters, numbers, hyphens, or underscores.</source>
</trans-unit>
<trans-unit id="++CODE++968729c173b0e6967fc054251835e9196b1e09ad7c55ab7b0acafb3402a9d5d6">
<source xml:lang="en">Website URL not found.</source>
</trans-unit>
<trans-unit id="++CODE++4ed689987736ce09e17c67eb32f441ca7d0f7ed013a282aafd1ebcf302e6386b">
<source xml:lang="en">Website not found in the environment. Please check the credentials and root folder path.</source>
<trans-unit id="++CODE++aa64cfbb63d3382bc0530c6e599467b1cc5c1ef8ff3b573d37ad628f9058b2aa">
<source xml:lang="en">Website not found in the environment. Please check the credentials and login with correct account.</source>
</trans-unit>
<trans-unit id="++CODE++e4bb03b399c07eeda658d87305435a58818cb5e0c3b76ae054d99564cf14ef6b">
<source xml:lang="en">What do you need help with?</source>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
},
{
"command": "microsoft.powerplatform.pages.preview-site",
"category": "Powerpages",
"title": "%powerplatform.pages.previewSite.title%"
}
],
Expand Down Expand Up @@ -817,7 +818,7 @@
},
{
"command": "microsoft.powerplatform.pages.preview-site",
"when": "microsoft.powerplatform.pages.siteRuntimePreviewEnabled"
"when": "microsoft.powerplatform.pages.siteRuntimePreviewEnabled && workspaceFolderCount == 1 && !isWeb"
},
{
"command": "powerPlatform.previewCurrentActiveUsers",
Expand Down
19 changes: 7 additions & 12 deletions src/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ import { EXTENSION_ID, SUCCESS } from "../common/constants";
import { AadIdKey, EnvIdKey, TenantIdKey } from "../common/OneDSLoggerTelemetry/telemetryConstants";
import { PowerPagesAppName, PowerPagesClientName } from "../common/ecs-features/constants";
import { ECSFeaturesClient } from "../common/ecs-features/ecsFeatureClient";
import { getECSOrgLocationValue } from "../common/utilities/Utils";
import { getECSOrgLocationValue, getWorkspaceFolders } from "../common/utilities/Utils";
import { CliAcquisitionContext } from "./lib/CliAcquisitionContext";
import { PreviewSite, SITE_PREVIEW_COMMAND_ID } from "./runtime-site-preview/PreviewSite";
import { PreviewSite, SITE_PREVIEW_COMMAND_ID } from "./preview-site/PreviewSite";

let client: LanguageClient;
let _context: vscode.ExtensionContext;
Expand Down Expand Up @@ -190,13 +190,8 @@ export async function activate(

let copilotNotificationShown = false;

const workspaceFolders =
vscode.workspace.workspaceFolders?.map(
(fl) => ({ ...fl, uri: fl.uri.fsPath } as WorkspaceFolder)
) || [];

const workspaceFolders = getWorkspaceFolders();

let websiteURL: string | undefined = "";
const isSiteRuntimePreviewEnabled = PreviewSite.isSiteRuntimePreviewEnabled();

vscode.commands.executeCommand("setContext", "microsoft.powerplatform.pages.siteRuntimePreviewEnabled", isSiteRuntimePreviewEnabled);
Expand Down Expand Up @@ -257,7 +252,7 @@ export async function activate(
}

if (artemisResponse !== null && isSiteRuntimePreviewEnabled) {
websiteURL = await PreviewSite.getWebSiteURL(workspaceFolders, artemisResponse?.stamp, orgDetails.EnvironmentId, _telemetry);
await PreviewSite.loadSiteUrl(workspaceFolders, artemisResponse?.stamp, orgDetails.EnvironmentId, _telemetry);
}

})
Expand All @@ -282,17 +277,17 @@ export async function activate(

_telemetry.sendTelemetryEvent("EnableSiteRuntimePreview", {
isEnabled: isSiteRuntimePreviewEnabled.toString(),
websiteURL: websiteURL
websiteURL: PreviewSite.getSiteUrl() || "undefined"
});
oneDSLoggerWrapper.getLogger().traceInfo("EnableSiteRuntimePreview", {
isEnabled: isSiteRuntimePreviewEnabled.toString(),
websiteURL: websiteURL
websiteURL: PreviewSite.getSiteUrl() || "undefined"
});

_context.subscriptions.push(
vscode.commands.registerCommand(
SITE_PREVIEW_COMMAND_ID,
async () => await PreviewSite.handlePreviewRequest(isSiteRuntimePreviewEnabled, websiteURL, _telemetry)
async () => await PreviewSite.handlePreviewRequest(isSiteRuntimePreviewEnabled, _telemetry, pacTerminal)
)
);

Expand Down
24 changes: 24 additions & 0 deletions src/client/preview-site/Constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

import * as vscode from 'vscode';

export const Messages = {
LOGIN: vscode.l10n.t("Login"),
CANCEL: vscode.l10n.t("Cancel"),
INSTALL: vscode.l10n.t("Install"),
EDGE_DEV_TOOLS_NOT_INSTALLED_MESSAGE: vscode.l10n.t({ message: "The extension 'Microsoft Edge Tools' is required to run this command. Do you want to install it now?", comment:["Do not translate 'Microsoft Edge Tools' "] }),
OPENING_SITE_PREVIEW: vscode.l10n.t("Opening site preview..."),
PREVIEW_SHOWN_FOR_PUBLISHED_CHANGES: vscode.l10n.t("The preview shown is for published changes."),
SITE_PREVIEW_FEATURE_NOT_ENABLED: vscode.l10n.t("Site runtime preview feature is not enabled."),
NO_FOLDER_OPENED: vscode.l10n.t("No workspace folder opened. Please open a site folder to preview."),
INITIALIZING_PREVIEW_TRY_AGAIN: vscode.l10n.t("Initializing site preview. Please try again after few seconds."),
WEBSITE_NOT_FOUND_IN_ENVIRONMENT: vscode.l10n.t("Website not found in the environment. Please check the credentials and login with correct account."),
INITIALIZING_PREVIEW: vscode.l10n.t("Initializing site preview"),
GETTING_ORG_DETAILS: vscode.l10n.t("Getting organization details..."),
GETTING_REGION_INFORMATION: vscode.l10n.t("Getting region information..."),
FAILED_TO_GET_ENDPOINT: vscode.l10n.t("Failed to get website endpoint. Please try again later"),
GETTING_WEBSITE_ENDPOINT: vscode.l10n.t("Getting website endpoint...")
};
Loading

0 comments on commit a82f277

Please sign in to comment.