Skip to content

Commit d72dda9

Browse files
authored
Improve support for connections without auth (Final PR for 1.14.0) (#629)
1 parent 962d146 commit d72dda9

2 files changed

Lines changed: 6 additions & 19 deletions

File tree

packages/vscode-extension/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Add command to run single cypher statement (ctrl+enter) and add new keybind for running all statements (ctrl+alt/cmd+enter)
99
- Modify run button to run selected text on selection and otherwise run single statement at cursor
1010
- Auto-focus on query results panel when running query
11-
- Minor bugfixes (handling new linter naming scheme, formatter capitalizing preparser keywords in namespaces, linter terminating on slow queries, missing label warnings, queries needing implicit transactions, "run cypher" keybind being active when cypher can't be run, formatting of dynamic labels, duplication in connections pane when db uses clustering (ex. aura business critical), linter switching for aura, point printing alignment with cypher shell)
11+
- Minor bugfixes (handling new linter naming scheme, formatter capitalizing preparser keywords in namespaces, linter terminating on slow queries, missing label warnings, queries needing implicit transactions, "run cypher" keybind being active when cypher can't be run, formatting of dynamic labels, duplication in connections pane when db uses clustering (ex. aura business critical), linter switching for aura, point printing alignment with cypher shell, empty fields being forbidden in the password/user fields when adding a connection)
1212

1313
## 1.13.0
1414
- Adjusts linting automatically depending on the neo4j version.

packages/vscode-extension/src/webviews/controllers/connectionPanelController.ts

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,28 @@ declare const vscode: vscode;
1313

1414
/**
1515
* Validates a Connection object and a password from the webview form.ƒ
16-
* @param connection The Connection object to validate. Only scheme, host, user, and password are required.
16+
* @param connection The Connection object to validate. Only scheme and host are required.
1717
* @param password The password to validate.
1818
* @returns True if the connection is valid, false otherwise.
1919
*/
20-
export function validateConnection(
21-
connection: Connection | null,
22-
password: string,
23-
): boolean {
20+
export function validateConnection(connection: Connection | null): boolean {
2421
highlightInvalidFields();
25-
return (
26-
!connection ||
27-
(!!connection.scheme &&
28-
!!connection.host &&
29-
!!connection.user &&
30-
!!password)
31-
);
22+
return !connection || (!!connection.scheme && !!connection.host);
3223
}
3324

3425
/**
3526
* Highlights any invalid fields in the webview form by toggling the invalid class.
36-
* Only scheme, host, user, and password are required.
27+
* Only scheme and host are required.
3728
*/
3829
export function highlightInvalidFields(): void {
3930
const scheme = document.getElementById('scheme') as HTMLInputElement;
4031
const host = document.getElementById('host') as HTMLInputElement;
41-
const user = document.getElementById('user') as HTMLInputElement;
42-
const password = document.getElementById('password') as HTMLInputElement;
4332

4433
scheme.classList.toggle(
4534
'invalid',
4635
!scheme.value || !isValidScheme(scheme.value),
4736
);
4837
host.classList.toggle('invalid', !host.value);
49-
user.classList.toggle('invalid', !user.value);
50-
password.classList.toggle('invalid', !password.value);
5138
}
5239

5340
/**
@@ -123,7 +110,7 @@ export function onSubmit(event: Event): boolean {
123110
const connection = getConnection();
124111
const password = getPassword();
125112

126-
if (!validateConnection(connection, password)) {
113+
if (!validateConnection(connection)) {
127114
vscode.postMessage({
128115
command: 'onValidationError',
129116
});

0 commit comments

Comments
 (0)