Skip to content

Commit 607bf47

Browse files
authored
Input UI normalization (#259)
1 parent ccfa549 commit 607bf47

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

src/api/addServer.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export async function addServer(
1010
return await vscode.window
1111
.showInputBox({
1212
ignoreFocusOut: true,
13-
placeHolder: "Name of new server definition",
13+
title: "Enter name of new server definition",
1414
validateInput: (value) => {
1515
if (value === "") {
1616
return "Required";
@@ -29,15 +29,15 @@ export async function addServer(
2929
if (name) {
3030
const description = await vscode.window.showInputBox({
3131
ignoreFocusOut: true,
32-
placeHolder: "Optional description",
32+
title: "Optionally enter a description",
3333
});
3434
if (typeof description !== "undefined") {
3535
if (description) {
3636
spec.description = description.trim();
3737
}
3838
const host = await vscode.window.showInputBox({
3939
ignoreFocusOut: true,
40-
placeHolder: "Hostname or IP address of web server",
40+
title: "Enter the hostname or IP address of the web server",
4141
validateInput: (value) => {
4242
return value.trim().length ? undefined : "Required";
4343
},
@@ -46,7 +46,7 @@ export async function addServer(
4646
spec.webServer.host = host.trim();
4747
const portString = await vscode.window.showInputBox({
4848
ignoreFocusOut: true,
49-
placeHolder: "Port of web server",
49+
title: "Enter the port of the web server",
5050
validateInput: (value) => {
5151
const port = +value;
5252
return value.match(/\d+/) &&
@@ -61,23 +61,26 @@ export async function addServer(
6161
spec.webServer.port = +portString;
6262
const prefix = await vscode.window.showInputBox({
6363
ignoreFocusOut: true,
64-
placeHolder:
65-
"Optional path prefix of instance",
64+
title:
65+
"Optionally enter the path prefix of the instance",
6666
});
6767
if (typeof prefix !== "undefined") {
6868
if (prefix) {
6969
var pathPrefix = prefix.trim();
70-
if (pathPrefix.charAt(0) !== "/") {
70+
if (!pathPrefix.startsWith("/")) {
7171
pathPrefix = "/" + pathPrefix;
7272
}
73+
if (pathPrefix.endsWith("/")) {
74+
pathPrefix = pathPrefix.slice(0, -1);
75+
}
7376
spec.webServer.pathPrefix = pathPrefix;
7477
}
7578
}
7679

7780
const username = await vscode.window.showInputBox({
7881
ignoreFocusOut: true,
79-
placeHolder:
80-
"Username",
82+
title:
83+
"Enter the username",
8184
prompt:
8285
"Leave empty to be prompted when connecting.",
8386
});
@@ -89,7 +92,7 @@ export async function addServer(
8992
const scheme = await new Promise<string | undefined>((resolve) => {
9093
let result: string;
9194
const quickPick = vscode.window.createQuickPick();
92-
quickPick.placeholder = "Confirm connection type, then the definition will be stored in your User Settings. 'Escape' to cancel.";
95+
quickPick.title = "Confirm the connection type, then the definition will be stored in your User Settings. 'Escape' to cancel.";
9396
quickPick.ignoreFocusOut = true;
9497
quickPick.items = [{ label: "http" }, { label: "https" }];
9598
quickPick.activeItems = [quickPick.items[spec.webServer.port == 443 ? 1 : 0]];

src/api/pickServer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export async function pickServer(
2626
let result: string;
2727
let resolveOnHide = true;
2828
const quickPick = vscode.window.createQuickPick();
29-
quickPick.title = "Choose server or use '+' to add one";
29+
quickPick.title = "Pick a server or use '+' to add one";
3030
quickPick.placeholder = options.placeHolder;
3131
quickPick.matchOnDescription = options.matchOnDescription || true;
3232
quickPick.matchOnDetail = options.matchOnDetail || false;

src/commands/importFromRegistry.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async function promptForUsernames(serverDefinitions: any, serversMissingUsername
152152
let serverName = serversMissingUsernames.splice(0, 1)[0];
153153
let username = await vscode.window.showInputBox({
154154
ignoreFocusOut: true,
155-
placeHolder: "Enter a username. Leave empty to be prompted at connect time.",
155+
title: "Enter a username. Leave empty to be prompted at connect time.",
156156
prompt: `Username for server '${serverName}'`,
157157
});
158158
if (username === undefined) {
@@ -175,7 +175,7 @@ async function promptForUsernames(serverDefinitions: any, serversMissingUsername
175175
const result = await vscode.window.showQuickPick(items, {
176176
canPickMany: false,
177177
ignoreFocusOut: true,
178-
placeHolder: `${serversMissingUsernames.length} more servers lack a username. What do you want to do?`,
178+
title: `${serversMissingUsernames.length} more servers lack a username. What do you want to do?`,
179179
});
180180
if (result === undefined || result.label === items[2].label) {
181181
return false;
@@ -219,7 +219,7 @@ async function promptForPasswords(secretStorage: vscode.SecretStorage, serverDef
219219
password = await vscode.window.showInputBox({
220220
ignoreFocusOut: true,
221221
password: true,
222-
placeHolder: "Enter password to store in keychain. Leave empty to be prompted at connect time.",
222+
title: "Enter the password to store in keychain. Leave empty to be prompted at connect time.",
223223
prompt: `Password for connection to InterSystems server '${serverName}'
224224
as ${serverDefinitions[serverName].username}`,
225225
});
@@ -234,7 +234,7 @@ async function promptForPasswords(secretStorage: vscode.SecretStorage, serverDef
234234
}
235235

236236
if ((reusePassword === undefined) && (promptServerNames.length > 1)) {
237-
const placeHolder = (password === undefined) ? `Enter password later for remaining ${promptServerNames.length - 1} server(s)?` : `Store the same password for remaining ${promptServerNames.length - 1} server(s)?`;
237+
const title = (password === undefined) ? `Enter password later for remaining ${promptServerNames.length - 1} server(s)?` : `Store the same password for remaining ${promptServerNames.length - 1} server(s)?`;
238238
const items = [
239239
`No`,
240240
`Yes`,
@@ -244,7 +244,7 @@ async function promptForPasswords(secretStorage: vscode.SecretStorage, serverDef
244244
const result = await vscode.window.showQuickPick(items, {
245245
canPickMany: false,
246246
ignoreFocusOut: true,
247-
placeHolder,
247+
title,
248248
});
249249
if (result === undefined || result.label === items[2].label) {
250250
return;

src/commonActivate.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ export function commonActivate(context: vscode.ExtensionContext, view: ServerMan
4444
if (!isfsExtension.isActive) {
4545
await isfsExtension.activate();
4646
if (!isfsExtension.isActive) {
47-
vscode.window.showErrorMessage(`${OBJECTSCRIPT_EXTENSIONID} could not be activated.`, "Close");
47+
vscode.window.showErrorMessage(`${OBJECTSCRIPT_EXTENSIONID} could not be activated.`, "Dismiss");
4848
return;
4949
}
5050
}
5151
} else {
52-
vscode.window.showErrorMessage(`${OBJECTSCRIPT_EXTENSIONID} is not installed.`, "Close");
52+
vscode.window.showErrorMessage(`${OBJECTSCRIPT_EXTENSIONID} is not installed.`, "Dismiss");
5353
return;
5454
}
5555

@@ -66,7 +66,7 @@ export function commonActivate(context: vscode.ExtensionContext, view: ServerMan
6666
if (added) {
6767
await view.addToRecents(serverName);
6868
} else {
69-
vscode.window.showErrorMessage(`Folder ${uri.toString()} could not be added.`, "Close");
69+
vscode.window.showErrorMessage(`Folder ${uri.toString()} could not be added.`, "Dismiss");
7070
}
7171
}
7272
// Switch to Explorer view and focus on the folder

0 commit comments

Comments
 (0)