From 1af6cf58525eff52f5c019e445cc93b5dd12493f Mon Sep 17 00:00:00 2001 From: Priyanshu Agrawal Date: Tue, 17 Dec 2024 15:57:14 +0530 Subject: [PATCH] Hide preview site command from palette when feature is disabled (#1080) --- package.json | 11 +++++++++-- src/client/extension.ts | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 40939fad..85b0b689 100644 --- a/package.json +++ b/package.json @@ -183,8 +183,7 @@ }, { "command": "powerpages.powerPagesFileExplorer.powerPagesRuntimePreview", - "title": "Preview site", - "when": "never" + "title": "Preview site" }, { "command": "powerpages.powerPagesFileExplorer.backToStudio", @@ -812,6 +811,14 @@ { "command": "microsoft-powerapps-portals.pagetemplate", "when": "config.powerPlatform.generatorInstalled" + }, + { + "command": "powerpages.powerPagesFileExplorer.powerPagesRuntimePreview", + "when": "never" + }, + { + "command": "microsoft.powerplatform.pages.preview-site", + "when": "microsoft.powerplatform.pages.siteRuntimePreviewEnabled" } ], "view/title": [ diff --git a/src/client/extension.ts b/src/client/extension.ts index 1feac8c7..e58bcf24 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -199,6 +199,8 @@ export async function activate( let websiteURL: string | undefined = ""; const isSiteRuntimePreviewEnabled = PreviewSite.isSiteRuntimePreviewEnabled(); + vscode.commands.executeCommand("setContext", "microsoft.powerplatform.pages.siteRuntimePreviewEnabled", isSiteRuntimePreviewEnabled); + _context.subscriptions.push( orgChangeEvent(async (orgDetails: ActiveOrgOutput) => { const orgID = orgDetails.OrgId;