Skip to content

Commit

Permalink
fixed build failures and handled empty website recordID
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrow1303 committed Nov 5, 2024
1 parent 99bd698 commit ad2e69f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
4 changes: 4 additions & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@
"Do not translate 'dotnet' or 'sdk'"
]
},
"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",
"No workspace folder is open.": "No workspace folder is open.",
"Failed to update launch.json: ${0}": "Failed to update launch.json: ${0}",
"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
12 changes: 12 additions & 0 deletions loc/translations-export/vscode-powerplatform.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,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++bc7c38bba120feb9d6acc70f0a26050f3ce2a70dd87afa046c3f962be7d015e3">
<source xml:lang="en">Failed to update launch.json: ${0}</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 @@ -208,6 +211,9 @@ Return to this chat and @powerpages can help you write and edit your website cod
<trans-unit id="++CODE++e992151b1efc99f93484c7d7f3076b66ab072a8af2383e96104cc597c971339c">
<source xml:lang="en">Insert code into editor</source>
</trans-unit>
<trans-unit id="++CODE++569ca49f4aaf7846e952c1d4aeca72febd0b79fa1c4f9db08fd3127551218572">
<source xml:lang="en">Install</source>
</trans-unit>
<trans-unit id="++CODE++25109e9c19daeeed3977b84ace83722ac8a4daafcfe4e3709082fcc5b228e7a8">
<source xml:lang="en">Installing Power Pages generator(v{0})...</source>
<note>{0} represents the version number</note>
Expand Down Expand Up @@ -285,6 +291,9 @@ The {3} represents Dataverse Environment's Organization ID (GUID)</note>
<trans-unit id="++CODE++6da29e062697a9f26659ef14ebda075afe939756af5d8e1d3451eb7d6d6e1a8a">
<source xml:lang="en">No workspace folder found</source>
</trans-unit>
<trans-unit id="++CODE++3c8a93afe6d6e99f8ad4b7fd72ffe91e62b1cbc29a8887d4922f80e92f4b78b2">
<source xml:lang="en">No workspace folder is open.</source>
</trans-unit>
<trans-unit id="++CODE++bda6bda1e902d120a7f4515ceac8546c3112e3cb9351df1d8b9713b8f86e0370">
<source xml:lang="en">One or more attribute names have been changed or removed. Contact your admin.</source>
</trans-unit>
Expand Down Expand Up @@ -382,6 +391,9 @@ 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>
<trans-unit id="++CODE++e4a2396fd7a366292a40abc87b18a2329458c258f4d0e0e593e6189dff19a117">
<source xml:lang="en">The name you want to give to this authentication profile</source>
</trans-unit>
Expand Down
5 changes: 1 addition & 4 deletions src/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,12 @@ import { ActiveOrgOutput } from "./pac/PacTypes";
import { desktopTelemetryEventNames } from "../common/OneDSLoggerTelemetry/client/desktopExtensionTelemetryEventNames";
import { ArtemisService } from "../common/services/ArtemisService";
import { workspaceContainsPortalConfigFolder } from "../common/utilities/PathFinderUtil";
import { getPortalsOrgURLs, getWebsiteRecordID } from "../common/utilities/WorkspaceInfoFinderUtil";
import { getPortalsOrgURLs } from "../common/utilities/WorkspaceInfoFinderUtil";
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 { ServiceEndpointCategory } from "../common/services/Constants";
import { PPAPIService } from "../common/services/PPAPIService";
import { EnableSiteRuntimePreview } from "../common/ecs-features/ecsFeatureGates";
import { PreviewSite } from "./runtimeSitePreview/PreviewSite";

let client: LanguageClient;
Expand Down
2 changes: 1 addition & 1 deletion src/client/runtimeSitePreview/LaunchJsonHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function updateLaunchJsonConfig(url: string): Promise<void> {
} catch (e) {
if(e instanceof Error) {
vscode.window.showErrorMessage(
vscode.l10n.t(`Failed to update launch.json: ${e.message}`));
vscode.l10n.t("Failed to update launch.json: ${0}", e.message));
}
}
}
11 changes: 9 additions & 2 deletions src/client/runtimeSitePreview/PreviewSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { WorkspaceFolder } from 'vscode-languageclient/node';
import { getWebsiteRecordID } from '../../common/utilities/WorkspaceInfoFinderUtil';
import { ServiceEndpointCategory } from '../../common/services/Constants';
import { PPAPIService } from '../../common/services/PPAPIService';
import { VSCODE_EXTENSION_GET_WEBSITE_RECORD_ID_EMPTY } from '../../common/services/TelemetryConstants';

export class PreviewSite {

Expand All @@ -30,6 +31,12 @@ export class PreviewSite {
static async getWebSiteURL(workspaceFolders: WorkspaceFolder[], stamp: ServiceEndpointCategory, envId: string, telemetry: ITelemetry): Promise<string> {

const websiteRecordId = getWebsiteRecordID(workspaceFolders, telemetry);
if (!websiteRecordId) {
telemetry.sendTelemetryEvent(VSCODE_EXTENSION_GET_WEBSITE_RECORD_ID_EMPTY, {
websiteRecordId: websiteRecordId
});
return "";
}
const websiteDetails = await PPAPIService.getWebsiteDetailsByWebsiteRecordId(stamp, envId, websiteRecordId, telemetry);
return websiteDetails?.websiteUrl || "";
}
Expand Down Expand Up @@ -84,11 +91,11 @@ export class PreviewSite {
} else {
const install = await vscode.window.showWarningMessage(
vscode.l10n.t(
`The extension "${edgeToolsExtensionId}" 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', 'Cancel'
));

if (install === 'Install') {
if (install === vscode.l10n.t('Install')) {
// Open the Extensions view with the specific extension
vscode.commands.executeCommand('workbench.extensions.search', edgeToolsExtensionId);
}
Expand Down
1 change: 1 addition & 0 deletions src/common/services/TelemetryConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ export const VSCODE_EXTENSION_PPAPI_GET_WEBSITE_BY_ID_FAILED = "VSCodeExtensionP
export const VSCODE_EXTENSION_SERVICE_STAMP_NOT_FOUND = "VSCodeExtensionServiceStampNotFound";
export const VSCODE_EXTENSION_PPAPI_GET_WEBSITE_DETAILS_FAILED = "VSCodeExtensionPPAPIGetWebsiteDetailsFailed";
export const VSCODE_EXTENSION_PPAPI_GET_WEBSITE_BY_RECORD_ID_COMPLETED = "VSCodeExtensionPPAPIGetWebsiteByRecordIdCompleted";
export const VSCODE_EXTENSION_GET_WEBSITE_RECORD_ID_EMPTY = "VSCodeExtensionGetWebsiteRecordIdEmpty";

0 comments on commit ad2e69f

Please sign in to comment.