Skip to content

Commit c3a0e30

Browse files
committed
chore: improve styles, fix unit tests
1 parent 2db721d commit c3a0e30

6 files changed

Lines changed: 65 additions & 8 deletions

File tree

apps/keira/src/assets/i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"SSH_HOST": "SSH Host",
5555
"SSH_PORT": "SSH Port",
5656
"SSH_USER": "SSH User",
57-
"SSH_PASSWORD": "SSH Password / Passphrase",
57+
"SSH_PASSWORD": "SSH Password",
5858
"SSH_PRIVATE_KEY": "Private Key",
5959
"SSH_KEY_PLACEHOLDER": "Optional - browse to select key file",
6060
"SAVE_PASSWORD": "Save password",

libs/main/connection-window/src/connection-window.component.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ $secondary-color-green: #b7e2ad;
157157
border: 0 !important;
158158

159159
i {
160-
margin-right: 10px;
160+
margin-right: 5px;
161161
margin-bottom: 2px;
162162
}
163163
}
@@ -173,6 +173,14 @@ $secondary-color-green: #b7e2ad;
173173
border-left: 2px solid rgba(255, 255, 255, 0.3);
174174
padding-left: 10px;
175175
margin-bottom: 4px;
176+
177+
.input-group-prepend {
178+
width: 145px;
179+
180+
.input-group-text {
181+
width: 145px;
182+
}
183+
}
176184
}
177185

178186
.connect-button {

libs/main/connection-window/src/connection-window.component.spec.ts

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ describe('ConnectionWindowComponent', () => {
143143
password: 'root',
144144
database: 'acore_world',
145145
sslEnabled: true,
146+
sshEnabled: false,
147+
sshHost: '',
148+
sshPort: 22,
149+
sshUser: '',
150+
sshPassword: '',
151+
sshPrivateKey: '',
146152
ssl: { rejectUnauthorized: false },
147153
});
148154
expect(component.error).toBeUndefined();
@@ -165,6 +171,12 @@ describe('ConnectionWindowComponent', () => {
165171
password: 'helias123',
166172
database: 'helias_world',
167173
sslEnabled: false,
174+
sshEnabled: false,
175+
sshHost: '',
176+
sshPort: 22,
177+
sshUser: '',
178+
sshPassword: '',
179+
sshPrivateKey: '',
168180
});
169181

170182
expect(component.error).toBeUndefined();
@@ -188,7 +200,20 @@ describe('ConnectionWindowComponent', () => {
188200
page.clickElement(page.connectBtn);
189201

190202
expect(connectSpy).toHaveBeenCalledTimes(1);
191-
expect(connectSpy).toHaveBeenCalledWith({ host, port, user, password, database, sslEnabled: false });
203+
expect(connectSpy).toHaveBeenCalledWith({
204+
host,
205+
port,
206+
user,
207+
password,
208+
database,
209+
sslEnabled: false,
210+
sshEnabled: false,
211+
sshHost: '',
212+
sshPort: 22,
213+
sshUser: '',
214+
sshPassword: '',
215+
sshPrivateKey: '',
216+
});
192217
expect(component.error).toBeUndefined();
193218
expect(page.errorElement.innerHTML).not.toContain('error-box');
194219
});
@@ -266,6 +291,12 @@ describe('ConnectionWindowComponent', () => {
266291
password,
267292
database: 'helias_world',
268293
sslEnabled: false,
294+
sshEnabled: false,
295+
sshHost: '',
296+
sshPort: 22,
297+
sshUser: '',
298+
sshPassword: '',
299+
sshPrivateKey: '',
269300
});
270301
expect(connectSpy).toHaveBeenCalledTimes(1);
271302
expect(connectSpy).toHaveBeenCalledWith({
@@ -275,6 +306,12 @@ describe('ConnectionWindowComponent', () => {
275306
password,
276307
database: 'helias_world',
277308
sslEnabled: false,
309+
sshEnabled: false,
310+
sshHost: '',
311+
sshPort: 22,
312+
sshUser: '',
313+
sshPassword: '',
314+
sshPrivateKey: '',
278315
});
279316
});
280317

@@ -295,6 +332,12 @@ describe('ConnectionWindowComponent', () => {
295332
password: '',
296333
database: 'helias_world',
297334
sslEnabled: false,
335+
sshEnabled: false,
336+
sshHost: '',
337+
sshPort: 22,
338+
sshUser: '',
339+
sshPassword: '',
340+
sshPrivateKey: '',
298341
});
299342
expect(connectSpy).toHaveBeenCalledTimes(1);
300343
expect(connectSpy).toHaveBeenCalledWith({
@@ -304,6 +347,12 @@ describe('ConnectionWindowComponent', () => {
304347
password: 'helias123',
305348
database: 'helias_world',
306349
sslEnabled: false,
350+
sshEnabled: false,
351+
sshHost: '',
352+
sshPort: 22,
353+
sshUser: '',
354+
sshPassword: '',
355+
sshPrivateKey: '',
307356
});
308357
});
309358
});

libs/main/connection-window/src/connection-window.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class ConnectionWindowComponent extends SubscriptionHandler implements On
7171
if (this.configs?.length > 0) {
7272
// get last saved config
7373
const lastConfig = this.configs[this.configs.length - 1];
74-
this.form.setValue(lastConfig);
74+
this.form.patchValue(lastConfig);
7575

7676
if (!this.form.getRawValue().password) {
7777
this.savePassword = false;
@@ -84,7 +84,7 @@ export class ConnectionWindowComponent extends SubscriptionHandler implements On
8484
}
8585

8686
loadConfig(config: Partial<KeiraConnectionOptions>): void {
87-
this.form.setValue(config);
87+
this.form.patchValue(config);
8888
}
8989

9090
removeAllConfigs(): void {

libs/shared/db-layer/src/mysql.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export class MysqlService {
166166
console.info(`DB connection lost. Reconnecting in ${RECONNECTION_TIME_MS} ms...`);
167167

168168
setTimeout(() => {
169-
if (this.config.sshEnabled) {
169+
if (this.config?.sshEnabled) {
170170
this.connectViaSshTunnel(this.config).subscribe({
171171
next: () => this.reconnectCallback(null),
172172
error: () => this.reconnect(),

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)