Success and progress notifications/log messages for PostgreSQL (#1560)
* progress and success notifications and log messages
This commit is contained in:
Родитель
140c026ea0
Коммит
6bafded0c3
|
@ -41,15 +41,18 @@ export async function setFirewallRule(treeItem: PostgresServerTreeItem, ip: stri
|
|||
endIpAddress: ip
|
||||
};
|
||||
|
||||
const progressMessage: string = localize('configuringFirewallRule', 'Adding firewall rule for IP "{0}" to server "{1}"...', ip, serverName);
|
||||
const options: vscode.ProgressOptions = {
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title: localize('configuringFirewall', 'Adding firewall rule for IP "{0}" to server "{1}"...', ip, serverName)
|
||||
title: progressMessage
|
||||
};
|
||||
|
||||
await vscode.window.withProgress(options, async () => {
|
||||
await client.firewallRules.createOrUpdate(resourceGroup, serverName, firewallRuleName, newFirewallRule);
|
||||
});
|
||||
|
||||
const completedMessage: string = localize('addedFirewallRule', 'Successfully added firewall rule for IP "{0}" to server "{1}".', ip, serverName);
|
||||
vscode.window.showInformationMessage(completedMessage);
|
||||
ext.outputChannel.appendLog(completedMessage);
|
||||
await treeItem.refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Server } from 'azure-arm-postgresql/lib/models';
|
||||
import * as vscode from 'vscode';
|
||||
import { Progress } from 'vscode';
|
||||
import { AzureWizardExecuteStep } from 'vscode-azureextensionui';
|
||||
import { ext } from '../../../../extensionVariables';
|
||||
|
@ -30,6 +31,9 @@ export class PostgresServerSetCredentialsStep extends AzureWizardExecuteStep<IPo
|
|||
const server: Server = nonNullProp(wizardContext, 'server');
|
||||
|
||||
await setPostgresCredentials(user, password, nonNullProp(server, 'id'));
|
||||
const completedMessage: string = localize('addedCredentialsMessage', 'Successfully setup credentials for server "{0}".', newServerName);
|
||||
vscode.window.showInformationMessage(completedMessage);
|
||||
ext.outputChannel.appendLog(completedMessage);
|
||||
}
|
||||
|
||||
public shouldExecute(): boolean {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import PostgreSQLManagementClient from 'azure-arm-postgresql';
|
||||
import { FirewallRule } from 'azure-arm-postgresql/lib/models';
|
||||
import * as vscode from 'vscode';
|
||||
import { Progress } from 'vscode';
|
||||
import { AzureWizardExecuteStep, createAzureClient } from 'vscode-azureextensionui';
|
||||
import { ext } from '../../../../extensionVariables';
|
||||
|
@ -33,6 +34,9 @@ export class PostgresServerSetFirewallStep extends AzureWizardExecuteStep<IPostg
|
|||
ext.outputChannel.appendLog(addFirewallMessage);
|
||||
await client.firewallRules.createOrUpdate(resourceGroup, newServerName, firewallRuleName, newFirewallRule);
|
||||
|
||||
const completedMessage: string = localize('addedFirewallRule', 'Successfully added firewall rule for IP "{0}" to server "{1}".', ip, newServerName);
|
||||
vscode.window.showInformationMessage(completedMessage);
|
||||
ext.outputChannel.appendLog(completedMessage);
|
||||
}
|
||||
|
||||
public shouldExecute(wizardContext: IPostgresServerWizardContext): boolean {
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Server } from "azure-arm-postgresql/lib/models";
|
||||
import * as vscode from 'vscode';
|
||||
import { IActionContext } from "vscode-azureextensionui";
|
||||
import { ext } from "../../extensionVariables";
|
||||
import { localize } from "../../utils/localize";
|
||||
import { nonNullProp } from "../../utils/nonNull";
|
||||
import { nonNullProp } from '../../utils/nonNull';
|
||||
import { PostgresServerTreeItem } from "../tree/PostgresServerTreeItem";
|
||||
import { setPostgresCredentials } from "./setPostgresCredentials";
|
||||
|
||||
|
@ -32,7 +32,22 @@ export async function enterPostgresCredentials(context: IActionContext, treeItem
|
|||
validateInput: (value: string) => { return (value && value.length) ? undefined : localize('passwordCannotBeEmpty', 'Password cannot be empty.'); }
|
||||
});
|
||||
|
||||
const server: Server = nonNullProp(treeItem, 'server');
|
||||
await setPostgresCredentials(username, password, nonNullProp(server, 'id'));
|
||||
const serverName: string = nonNullProp(treeItem.server, 'name');
|
||||
const id: string = nonNullProp(treeItem.server, 'id');
|
||||
|
||||
const progressMessage: string = localize('setupCredentialsMessage', 'Setting up credentials for server "{0}"...', serverName);
|
||||
const options: vscode.ProgressOptions = {
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title: progressMessage
|
||||
};
|
||||
|
||||
await vscode.window.withProgress(options, async () => {
|
||||
await setPostgresCredentials(username, password, id);
|
||||
});
|
||||
|
||||
const completedMessage: string = localize('setupCredentialsMessage', 'Successfully added credentials to server "{0}".', serverName);
|
||||
vscode.window.showInformationMessage(completedMessage);
|
||||
ext.outputChannel.appendLog(completedMessage);
|
||||
|
||||
await treeItem.refresh();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче