Skip to content

Commit

Permalink
Hide preview site command from palette when feature is disabled (#1080)
Browse files Browse the repository at this point in the history
  • Loading branch information
priyanshu92 authored Dec 17, 2024
1 parent 50fa107 commit 1af6cf5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@
},
{
"command": "powerpages.powerPagesFileExplorer.powerPagesRuntimePreview",
"title": "Preview site",
"when": "never"
"title": "Preview site"
},
{
"command": "powerpages.powerPagesFileExplorer.backToStudio",
Expand Down Expand Up @@ -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": [
Expand Down
2 changes: 2 additions & 0 deletions src/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1af6cf5

Please sign in to comment.