Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site visibility dialog #272

Merged
merged 3 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions loc/translations-export/vscode-powerplatform.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,14 @@ The {2} represents Solution's Version number</note>
</trans-unit>
</body></file>
<file original="./web/client/extension" source-language="en" datatype="plaintext"><body>
<trans-unit id="microsoft-powerapps-portals.webExtension.init.message">
<source xml:lang="en">Opening VS Code for the web ...</source>
<trans-unit id="microsoft-powerapps-portals.webExtension.init.sitevisibility.edit">
<source xml:lang="en">Edit the site</source>
</trans-unit>
<trans-unit id="microsoft-powerapps-portals.webExtension.init.sitevisibility.edit.desc">
<source xml:lang="en">Be careful making changes. Anyone can see the changes you make immediately. Choose Edit the site to make edits, or close the editor tab to cancel without editing.</source>
</trans-unit>
<trans-unit id="microsoft-powerapps-portals.webExtension.init.sitevisibility.edit.title">
<source xml:lang="en">You are editing a live, public site </source>
</trans-unit>
<trans-unit id="microsoft-powerapps-portals.webExtension.init.error">
<source xml:lang="en">There was a problem opening the workspace</source>
Expand Down
2 changes: 2 additions & 0 deletions src/web/client/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const CHARSET = 'utf-8';
export const PROVIDER_ID = "microsoft";
export const SCOPE_OPTION = "//.default";
export const BAD_REQUEST = 'BAD_REQUEST';
export const PUBLIC = 'public';
export const SITE_VISIBILITY = 'siteVisibility';

export enum httpMethod {
PATCH = 'PATCH',
Expand Down
13 changes: 11 additions & 2 deletions src/web/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TelemetryReporter from "@vscode/extension-telemetry";
import { AI_KEY } from '../../client/constants';
import { dataverseAuthentication } from "./common/authenticationProvider";
import { setContext } from "./common/localStore";
import { ORG_URL, PORTALS_URI_SCHEME, telemetryEventNames } from "./common/constants";
import { ORG_URL, PORTALS_URI_SCHEME, telemetryEventNames, SITE_VISIBILITY, PUBLIC } from "./common/constants";
import { PortalsFS } from "./common/fileSystemProvider";
import { checkMandatoryParameters, removeEncodingFromParameters, ERRORS, showErrorDialog } from "./common/errorHandler";
import { sendErrorTelemetry, sendExtensionInitPathParametersTelemetry, sendExtensionInitQueryParametersTelemetry, sendPerfTelemetry, setTelemetryReporter } from "./telemetry/webExtensionTelemetry";
Expand All @@ -34,7 +34,8 @@ export function activate(context: vscode.ExtensionContext): void {
"microsoft-powerapps-portals.webExtension.init",
async (args) => {
_telemetry.sendTelemetryEvent("StartCommand", { 'commandId': 'microsoft-powerapps-portals.webExtension.init' });
vscode.window.showInformationMessage(localize("microsoft-powerapps-portals.webExtension.init.message", "Opening VS Code for the web ..."));

vscode.window.showInformationMessage("Opening VS Code for the web ...");
vedg marked this conversation as resolved.
Show resolved Hide resolved
const { appName, entity, entityId, searchParams } = args;
sendExtensionInitPathParametersTelemetry(appName, entity, entityId);
const queryParamsMap = new Map<string, string>();
Expand All @@ -45,6 +46,14 @@ export function activate(context: vscode.ExtensionContext): void {
queryParamsMap.set(pair[0], pair[1]);
}
}

if (queryParamsMap.get(SITE_VISIBILITY) === PUBLIC) {
const edit: vscode.MessageItem = { isCloseAffordance: true, title: localize("microsoft-powerapps-portals.webExtension.init.sitevisibility.edit","Edit the site") };
vedg marked this conversation as resolved.
Show resolved Hide resolved
const siteMessage = localize("microsoft-powerapps-portals.webExtension.init.sitevisibility.edit.desc","Be careful making changes. Anyone can see the changes you make immediately. Choose Edit the site to make edits, or close the editor tab to cancel without editing.");
const options = { detail: siteMessage, modal: true };
await vscode.window.showWarningMessage(localize("microsoft-powerapps-portals.webExtension.init.sitevisibility.edit.title","You are editing a live, public site "), options, edit);
}

let accessToken: string;
if (appName) {
switch (appName) {
Expand Down
7 changes: 0 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ const webConfig = {
test: /\.ts$/,
exclude: /node_modules/,
use: [{
// vscode-nls-dev loader:
vedg marked this conversation as resolved.
Show resolved Hide resolved
// * rewrite nls-calls
loader: 'vscode-nls-dev/lib/webpack-loader',
options: {
base: __dirname
}
},{
loader: 'ts-loader'
}]
}]
Expand Down