Add hint for visual task when user setting is in cloudshell (#112)

* add hint for visual task when user setting is in cloudshell

* refine the wording
This commit is contained in:
Sheng Chen 2018-02-09 14:12:33 +08:00 коммит произвёл GitHub
Родитель 09485fbd0a
Коммит 09fae2bd9e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -6,7 +6,7 @@ import { CloudShell } from "./cloudShell";
import { Constants } from "./constants";
import { IntegratedShell } from "./integratedShell";
import { TestOption } from "./shared";
import { isDotInstalled } from "./utils/dotUtils";
import { DialogOption } from "./utils/uiUtils";
import { selectWorkspaceFolder } from "./utils/workspaceUtils";
let cs: CloudShell;
@ -52,9 +52,17 @@ export function activate(ctx: vscode.ExtensionContext) {
}));
ctx.subscriptions.push(vscode.commands.registerCommand("vscode-terraform-azure.visualize", async () => {
if (await isDotInstalled()) {
await is.visualize();
if (terminalSetToCloudshell()) {
const choice: vscode.MessageItem = await vscode.window.showInformationMessage(
"Visualization only works locally. Would you like to run it in the integrated terminal?",
DialogOption.OK,
DialogOption.CANCEL,
);
if (choice === DialogOption.CANCEL) {
return;
}
}
await is.visualize();
}));
ctx.subscriptions.push(vscode.commands.registerCommand("vscode-terraform-azure.exectest", async () => {

Просмотреть файл

@ -13,6 +13,7 @@ import { isServicePrincipalSetInEnv } from "./utils/azureUtils";
import { executeCommand } from "./utils/cpUtils";
import { isDockerInstalled, latestTestingImagePulled, runE2EInDocker, runLintInDocker } from "./utils/dockerUtils";
import { drawGraph } from "./utils/dotUtils";
import { isDotInstalled } from "./utils/dotUtils";
import { selectWorkspaceFolder } from "./utils/workspaceUtils";
export class IntegratedShell extends BaseShell {
@ -20,6 +21,9 @@ export class IntegratedShell extends BaseShell {
// Creates a png of terraform resource graph to visualize the resources under management.
public async visualize(): Promise<void> {
if (!await isDotInstalled()) {
return;
}
const cwd: string = await selectWorkspaceFolder();
if (!cwd) {
return;