mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-29 01:11:37 +03:00
Fix Javascript issue on non sqlite databases
When a non sqlite database is used, loading the admin interface fails because the backup button is not generated. This PR is solves it by checking if the elements are valid. Also made some other changes and fixed some eslint errors. Showing `_post` errors is better now. Update jquery to latest version. Fixes #3166
This commit is contained in:
22
src/static/scripts/admin_diagnostics.js
vendored
22
src/static/scripts/admin_diagnostics.js
vendored
@@ -1,4 +1,6 @@
|
||||
"use strict";
|
||||
/* eslint-env es2017, browser */
|
||||
/* global BASE_URL:readable, BSN:readable */
|
||||
|
||||
var dnsCheck = false;
|
||||
var timeCheck = false;
|
||||
@@ -65,7 +67,7 @@ function checkVersions(platform, installed, latest, commit=null) {
|
||||
|
||||
// ================================
|
||||
// Generate support string to be pasted on github or the forum
|
||||
async function generateSupportString(dj) {
|
||||
async function generateSupportString(event, dj) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
@@ -114,7 +116,7 @@ async function generateSupportString(dj) {
|
||||
document.getElementById("copy-support").classList.remove("d-none");
|
||||
}
|
||||
|
||||
function copyToClipboard() {
|
||||
function copyToClipboard(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
@@ -208,12 +210,18 @@ function init(dj) {
|
||||
}
|
||||
|
||||
// onLoad events
|
||||
document.addEventListener("DOMContentLoaded", (/*event*/) => {
|
||||
document.addEventListener("DOMContentLoaded", (event) => {
|
||||
const diag_json = JSON.parse(document.getElementById("diagnostics_json").innerText);
|
||||
init(diag_json);
|
||||
|
||||
document.getElementById("gen-support").addEventListener("click", () => {
|
||||
generateSupportString(diag_json);
|
||||
});
|
||||
document.getElementById("copy-support").addEventListener("click", copyToClipboard);
|
||||
const btnGenSupport = document.getElementById("gen-support");
|
||||
if (btnGenSupport) {
|
||||
btnGenSupport.addEventListener("click", () => {
|
||||
generateSupportString(event, diag_json);
|
||||
});
|
||||
}
|
||||
const btnCopySupport = document.getElementById("copy-support");
|
||||
if (btnCopySupport) {
|
||||
btnCopySupport.addEventListener("click", copyToClipboard);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user