Skip to content

Input UI normalization #259

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

Merged
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
23 changes: 13 additions & 10 deletions src/api/addServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function addServer(
return await vscode.window
.showInputBox({
ignoreFocusOut: true,
placeHolder: "Name of new server definition",
title: "Enter name of new server definition",
validateInput: (value) => {
if (value === "") {
return "Required";
Expand All @@ -29,15 +29,15 @@ export async function addServer(
if (name) {
const description = await vscode.window.showInputBox({
ignoreFocusOut: true,
placeHolder: "Optional description",
title: "Optionally enter a description",
});
if (typeof description !== "undefined") {
if (description) {
spec.description = description.trim();
}
const host = await vscode.window.showInputBox({
ignoreFocusOut: true,
placeHolder: "Hostname or IP address of web server",
title: "Enter the hostname or IP address of the web server",
validateInput: (value) => {
return value.trim().length ? undefined : "Required";
},
Expand All @@ -46,7 +46,7 @@ export async function addServer(
spec.webServer.host = host.trim();
const portString = await vscode.window.showInputBox({
ignoreFocusOut: true,
placeHolder: "Port of web server",
title: "Enter the port of the web server",
validateInput: (value) => {
const port = +value;
return value.match(/\d+/) &&
Expand All @@ -61,23 +61,26 @@ export async function addServer(
spec.webServer.port = +portString;
const prefix = await vscode.window.showInputBox({
ignoreFocusOut: true,
placeHolder:
"Optional path prefix of instance",
title:
"Optionally enter the path prefix of the instance",
});
if (typeof prefix !== "undefined") {
if (prefix) {
var pathPrefix = prefix.trim();
if (pathPrefix.charAt(0) !== "/") {
if (!pathPrefix.startsWith("/")) {
pathPrefix = "/" + pathPrefix;
}
if (pathPrefix.endsWith("/")) {
pathPrefix = pathPrefix.slice(0, -1);
}
spec.webServer.pathPrefix = pathPrefix;
}
}

const username = await vscode.window.showInputBox({
ignoreFocusOut: true,
placeHolder:
"Username",
title:
"Enter the username",
prompt:
"Leave empty to be prompted when connecting.",
});
Expand All @@ -89,7 +92,7 @@ export async function addServer(
const scheme = await new Promise<string | undefined>((resolve) => {
let result: string;
const quickPick = vscode.window.createQuickPick();
quickPick.placeholder = "Confirm connection type, then the definition will be stored in your User Settings. 'Escape' to cancel.";
quickPick.title = "Confirm the connection type, then the definition will be stored in your User Settings. 'Escape' to cancel.";
quickPick.ignoreFocusOut = true;
quickPick.items = [{ label: "http" }, { label: "https" }];
quickPick.activeItems = [quickPick.items[spec.webServer.port == 443 ? 1 : 0]];
Expand Down
2 changes: 1 addition & 1 deletion src/api/pickServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function pickServer(
let result: string;
let resolveOnHide = true;
const quickPick = vscode.window.createQuickPick();
quickPick.title = "Choose server or use '+' to add one";
quickPick.title = "Pick a server or use '+' to add one";
quickPick.placeholder = options.placeHolder;
quickPick.matchOnDescription = options.matchOnDescription || true;
quickPick.matchOnDetail = options.matchOnDetail || false;
Expand Down
10 changes: 5 additions & 5 deletions src/commands/importFromRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async function promptForUsernames(serverDefinitions: any, serversMissingUsername
let serverName = serversMissingUsernames.splice(0, 1)[0];
let username = await vscode.window.showInputBox({
ignoreFocusOut: true,
placeHolder: "Enter a username. Leave empty to be prompted at connect time.",
title: "Enter a username. Leave empty to be prompted at connect time.",
prompt: `Username for server '${serverName}'`,
});
if (username === undefined) {
Expand All @@ -175,7 +175,7 @@ async function promptForUsernames(serverDefinitions: any, serversMissingUsername
const result = await vscode.window.showQuickPick(items, {
canPickMany: false,
ignoreFocusOut: true,
placeHolder: `${serversMissingUsernames.length} more servers lack a username. What do you want to do?`,
title: `${serversMissingUsernames.length} more servers lack a username. What do you want to do?`,
});
if (result === undefined || result.label === items[2].label) {
return false;
Expand Down Expand Up @@ -219,7 +219,7 @@ async function promptForPasswords(secretStorage: vscode.SecretStorage, serverDef
password = await vscode.window.showInputBox({
ignoreFocusOut: true,
password: true,
placeHolder: "Enter password to store in keychain. Leave empty to be prompted at connect time.",
title: "Enter the password to store in keychain. Leave empty to be prompted at connect time.",
prompt: `Password for connection to InterSystems server '${serverName}'
as ${serverDefinitions[serverName].username}`,
});
Expand All @@ -234,7 +234,7 @@ async function promptForPasswords(secretStorage: vscode.SecretStorage, serverDef
}

if ((reusePassword === undefined) && (promptServerNames.length > 1)) {
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)?`;
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)?`;
const items = [
`No`,
`Yes`,
Expand All @@ -244,7 +244,7 @@ async function promptForPasswords(secretStorage: vscode.SecretStorage, serverDef
const result = await vscode.window.showQuickPick(items, {
canPickMany: false,
ignoreFocusOut: true,
placeHolder,
title,
});
if (result === undefined || result.label === items[2].label) {
return;
Expand Down
6 changes: 3 additions & 3 deletions src/commonActivate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ export function commonActivate(context: vscode.ExtensionContext, view: ServerMan
if (!isfsExtension.isActive) {
await isfsExtension.activate();
if (!isfsExtension.isActive) {
vscode.window.showErrorMessage(`${OBJECTSCRIPT_EXTENSIONID} could not be activated.`, "Close");
vscode.window.showErrorMessage(`${OBJECTSCRIPT_EXTENSIONID} could not be activated.`, "Dismiss");
return;
}
}
} else {
vscode.window.showErrorMessage(`${OBJECTSCRIPT_EXTENSIONID} is not installed.`, "Close");
vscode.window.showErrorMessage(`${OBJECTSCRIPT_EXTENSIONID} is not installed.`, "Dismiss");
return;
}

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