refactor: improve code readability and formatting in profiles.js and tabs.js

- Updated formatting for better readability, including consistent use of line breaks and indentation.
- Enhanced the clarity of event listener functions in profiles.js.
- Refactored tab management logic in tabs.js for improved maintainability.
- Ensured consistent use of single quotes and double quotes across the files.
This commit is contained in:
Andy Dixon
2026-04-22 14:57:01 +01:00
parent 8fa9fb5be5
commit 98ca4743e5
6 changed files with 1083 additions and 1002 deletions
+21 -18
View File
@@ -1659,7 +1659,9 @@
<button class="btn btn-icon btn-danger jump-host-remove" data-index="${i}" title="Remove">&times;</button>
</div>
`;
const keyInput = row.querySelector(`input[name="jumpHost-${i}-privateKeyPath"]`);
const keyInput = row.querySelector(
`input[name="jumpHost-${i}-privateKeyPath"]`,
);
const browseBtn = row.querySelector(".jump-host-browse");
const error = createElement("span", "form-error");
error.style.display = "none";
@@ -1712,7 +1714,9 @@
_attachKeyPathValidation(input, errorEl, successEl) {
if (!input || !errorEl) return;
input.addEventListener("blur", () => this._validateKeyPath(input, errorEl, successEl));
input.addEventListener("blur", () =>
this._validateKeyPath(input, errorEl, successEl),
);
input.addEventListener("input", () => {
errorEl.style.display = "none";
errorEl.textContent = "";
@@ -1757,24 +1761,23 @@
}
return;
}
return window.go.api.Service.FileIsPrivateKey(value)
.then((isKey) => {
if (!isKey) {
errorEl.textContent = "File is not a recognised private key.";
errorEl.style.display = "block";
if (successEl) {
successEl.style.display = "none";
successEl.textContent = "";
}
return;
}
errorEl.style.display = "none";
errorEl.textContent = "";
return window.go.api.Service.FileIsPrivateKey(value).then((isKey) => {
if (!isKey) {
errorEl.textContent = "File is not a recognised private key.";
errorEl.style.display = "block";
if (successEl) {
successEl.textContent = "Key verified.";
successEl.style.display = "block";
successEl.style.display = "none";
successEl.textContent = "";
}
});
return;
}
errorEl.style.display = "none";
errorEl.textContent = "";
if (successEl) {
successEl.textContent = "Key verified.";
successEl.style.display = "block";
}
});
})
.catch(() => {
errorEl.textContent = "Could not verify this path.";