(GH-136) User experience improvement (#173)
* (GH-136) Device to cloud input box with ignoreFocusOut set to true * (GH-136) Display error message when expiration time for SAS Token is not a number
This commit is contained in:
Родитель
7785f5e5a7
Коммит
ab756356b0
|
@ -25,7 +25,7 @@ export class IoTHubMessageExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
const deviceConnectionString: string = deviceItem.connectionString;
|
||||
vscode.window.showInputBox({ prompt: `Enter message to send to ${Constants.IoTHub}` }).then((message: string) => {
|
||||
vscode.window.showInputBox({ prompt: `Enter message to send to ${Constants.IoTHub}`, ignoreFocusOut: true }).then((message: string) => {
|
||||
if (message !== undefined) {
|
||||
this._outputChannel.show();
|
||||
try {
|
||||
|
|
|
@ -184,14 +184,20 @@ export class IoTHubResourceExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
private async generateSasToken(sasTokenFunction: (connectionString: string, expiryInHours: number) => string, connectionString: string, target: string) {
|
||||
const expiryInHours = await vscode.window.showInputBox({ prompt: `Enter expiration time (hours)`, ignoreFocusOut: true });
|
||||
if (expiryInHours && !isNaN(parseFloat(expiryInHours))) {
|
||||
const sasToken = sasTokenFunction(connectionString, parseFloat(expiryInHours));
|
||||
clipboardy.write(sasToken);
|
||||
this._outputChannel.show();
|
||||
this.outputLine("SASToken", `SAS token for [${target}] is generated and copied to clipboard:`);
|
||||
this._outputChannel.appendLine(sasToken);
|
||||
}
|
||||
const expiryInHours = await vscode.window.showInputBox({
|
||||
prompt: `Enter expiration time (hours)`,
|
||||
ignoreFocusOut: true,
|
||||
validateInput: (value: string) => {
|
||||
if (!value || isNaN(parseFloat(value))) {
|
||||
return "Provided expiration time is not a number, enter correct expiration time (hours).";
|
||||
}
|
||||
}});
|
||||
|
||||
const sasToken = sasTokenFunction(connectionString, parseFloat(expiryInHours));
|
||||
clipboardy.write(sasToken);
|
||||
this._outputChannel.show();
|
||||
this.outputLine("SASToken", `SAS token for [${target}] is generated and copied to clipboard:`);
|
||||
this._outputChannel.appendLine(sasToken);
|
||||
}
|
||||
|
||||
private async waitForLogin(): Promise<boolean> {
|
||||
|
|
Загрузка…
Ссылка в новой задаче