Skip to content
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

Added Keepalive interval login settings #2077

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion src/api/IBMi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default class IBMi {
async connect(connectionObject: ConnectionData, reconnecting?: boolean, reloadServerSettings: boolean = false): Promise<{ success: boolean, error?: any }> {
return await Tools.withContext("code-for-ibmi:connecting", async () => {
try {
connectionObject.keepaliveInterval = 35000;
connectionObject.keepaliveInterval = connectionObject.keepaliveInterval === undefined ? 35000 : connectionObject.keepaliveInterval;

configVars.replaceAll(connectionObject);

Expand Down
2 changes: 2 additions & 0 deletions src/locale/ids/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@
"JOB_STATUS": "Job status",
"JOB_USER": "Job bruger",
"jvm.info": "JVM information",
"keepaliveInterval":"Keepalive interval",
"keepaliveInterval.description":"Frekvens (millisekunder) for afsendelsen af SSH keepalive pakker til serveren. Sæt til 0 for at deaktivere.",
"length": "Længde",
"LibraryListView.addToLibraryList.addedLib": "Bibliotek {0} blev tilføjet til bibliotekslisten.",
"LibraryListView.addToLibraryList.alreadyInList": "Bibliotek {0} er allerede i bibliotekslisten.",
Expand Down
2 changes: 2 additions & 0 deletions src/locale/ids/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@
"JOB_STATUS": "Job status",
"JOB_USER": "Job user",
"jvm.info": "JVM information",
"keepaliveInterval":"Keepalive interval",
"keepaliveInterval.description":"How often (in milliseconds) to send SSH-level keepalive packets to the server. Set to 0 to disable.",
"length": "Length",
"LibraryListView.addToLibraryList.addedLib": "Library {0} was added to the library list.",
"LibraryListView.addToLibraryList.alreadyInList": "Library {0} was already in the library list.",
Expand Down
2 changes: 2 additions & 0 deletions src/locale/ids/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@
"JOB_STATUS": "Status du job",
"JOB_USER": "Utilisateur",
"jvm.info": "Information JVM",
"keepaliveInterval":"Intervalle keepalive",
"keepaliveInterval.description":"Définit l'intervalle (en millisecondes) entre deux envois au serveur SSH du signal keepalive. Mettre 0 pour désactiver.",
"length": "Longueur",
"LibraryListView.addToLibraryList.addedLib": "La bibliohtèque {0} a été ajoutée à la liste des bibliothèques.",
"LibraryListView.addToLibraryList.alreadyInList": "La bibliohtèque {0} est déjà dans la liste des bibliothèques.",
Expand Down
7 changes: 5 additions & 2 deletions src/webviews/login/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import vscode from "vscode";
import { ConnectionConfiguration, ConnectionManager, GlobalConfiguration } from "../../api/Configuration";
import { ConnectionConfiguration, ConnectionManager } from "../../api/Configuration";
import { CustomUI, Section } from "../../api/CustomUI";
import IBMi from "../../api/IBMi";
import { disconnect, instance } from "../../instantiate";
import { ConnectionData } from '../../typings';
import { t } from "../../locale";
import { ConnectionData } from '../../typings';

type NewLoginSettings = ConnectionData & {
savePassword: boolean
Expand All @@ -30,6 +30,7 @@ export class Login {
.addInput(`host`, t(`login.host`), undefined, { minlength: 1 })
.addInput(`port`, t(`login.port`), ``, { default: `22`, minlength: 1, maxlength: 5, regexTest: `^\\d+$` })
.addInput(`username`, t(`username`), undefined, { minlength: 1, maxlength: 10 })
.addInput(`keepaliveInterval`, t('keepaliveInterval'), t('keepaliveInterval.description'), { default: '35000', regexTest: `^\\d*$` })
.addParagraph(t(`login.authDecision`))
.addPassword(`password`, t(`password`))
.addCheckbox(`savePassword`, t(`login.savePassword`))
Expand All @@ -55,6 +56,7 @@ export class Login {
page.panel.dispose();

data.port = Number(data.port);
data.keepaliveInterval = Number(data.keepaliveInterval);
data.privateKeyPath = data.privateKeyPath?.trim() ? data.privateKeyPath : undefined;
if (data.name) {
const existingConnection = ConnectionManager.getByName(data.name);
Expand All @@ -67,6 +69,7 @@ export class Login {
name: data.name,
host: data.host,
port: data.port,
keepaliveInterval: data.keepaliveInterval,
username: data.username,
privateKeyPath: data.privateKeyPath
};
Expand Down
2 changes: 2 additions & 0 deletions src/webviews/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ export class SettingsUI {
.addInput(`host`, t(`login.host`), undefined, { default: stored.host, minlength: 1 })
.addInput(`port`, t(`login.port`), undefined, { default: String(stored.port), minlength: 1, maxlength: 5, regexTest: `^\\d+$` })
.addInput(`username`, t(`username`), undefined, { default: stored.username, minlength: 1 })
.addInput(`keepaliveInterval`, t('keepaliveInterval'), t('keepaliveInterval.description'), { default: String(stored.keepaliveInterval !== undefined ? stored.keepaliveInterval : 35000), regexTest: `^\\d*$` })
.addParagraph(t(`login.authDecision`))
.addPassword(`password`, `${t(`password`)}${storedPassword ? ` (${t(`stored`)})` : ``}`, t(`login.password.label`))
.addFile(`privateKeyPath`, `${t(`privateKey`)}${stored.privateKeyPath ? ` (${t(`current`)}: ${stored.privateKeyPath})` : ``}`, t(`login.privateKey.label`) + ' ' + t(`login.privateKey.support`))
Expand Down Expand Up @@ -387,6 +388,7 @@ export class SettingsUI {

//Fix values before assigning the data
data.port = Number(data.port);
data.keepaliveInterval = Number(data.keepaliveInterval);
delete data.password;
delete data.buttons;

Expand Down