mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-03-23 02:09:20 -07: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:
26
src/static/scripts/admin_organizations.js
vendored
26
src/static/scripts/admin_organizations.js
vendored
@@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
/* eslint-env es2017, browser, jquery */
|
||||
/* global _post:readable, BASE_URL:readable, reload:readable, jdenticon:readable */
|
||||
|
||||
function deleteOrganization() {
|
||||
function deleteOrganization(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const org_uuid = event.target.dataset.vwOrgUuid;
|
||||
@@ -28,9 +30,22 @@ function deleteOrganization() {
|
||||
}
|
||||
}
|
||||
|
||||
function initActions() {
|
||||
document.querySelectorAll("button[vw-delete-organization]").forEach(btn => {
|
||||
btn.addEventListener("click", deleteOrganization);
|
||||
});
|
||||
|
||||
if (jdenticon) {
|
||||
jdenticon();
|
||||
}
|
||||
}
|
||||
|
||||
// onLoad events
|
||||
document.addEventListener("DOMContentLoaded", (/*event*/) => {
|
||||
jQuery("#orgs-table").DataTable({
|
||||
"drawCallback": function() {
|
||||
initActions();
|
||||
},
|
||||
"stateSave": true,
|
||||
"responsive": true,
|
||||
"lengthMenu": [
|
||||
@@ -46,9 +61,10 @@ document.addEventListener("DOMContentLoaded", (/*event*/) => {
|
||||
});
|
||||
|
||||
// Add click events for organization actions
|
||||
document.querySelectorAll("button[vw-delete-organization]").forEach(btn => {
|
||||
btn.addEventListener("click", deleteOrganization);
|
||||
});
|
||||
initActions();
|
||||
|
||||
document.getElementById("reload").addEventListener("click", reload);
|
||||
const btnReload = document.getElementById("reload");
|
||||
if (btnReload) {
|
||||
btnReload.addEventListener("click", reload);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user