mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-10-24 23:46:49 +03:00
Misc Updates (#7676)
* Misc Updates - Update Rust to v1.98.0 - Update all the crates and adjusted code where needed - Updated JavaScript libraries Removed jquery as this isn't needed anymore, adjusted code where needed - Updated all GitHub Actions - Fixed nightly clippy lint warnings Signed-off-by: BlackDex <black.dex@gmail.com> * Adjust email validation as suggested Signed-off-by: BlackDex <black.dex@gmail.com> --------- Signed-off-by: BlackDex <black.dex@gmail.com>
This commit is contained in:
1 parent
fdc156b247
commit
6729e83521
23 files changed
+13321
-21525
No files matched your search
Vendored
+35
-41
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
/* global jQuery, _post:readable, _delete:readable, BASE_URL:readable, reload:readable, jdenticon:readable */
|
||||
/* global DataTable, _post:readable, _delete:readable, BASE_URL:readable, reload:readable, jdenticon:readable */
|
||||
|
||||
function deleteUser(event) {
|
||||
event.preventDefault();
|
||||
@@ -141,7 +141,7 @@ function inviteUser(event) {
|
||||
);
|
||||
}
|
||||
|
||||
function resendUserInvite (event) {
|
||||
function resendUserInvite(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const id = event.target.parentNode.dataset.vwUserUuid;
|
||||
@@ -179,37 +179,9 @@ const ORG_TYPES = {
|
||||
},
|
||||
};
|
||||
|
||||
// Special sort function to sort dates in ISO format
|
||||
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
|
||||
"date-iso-pre": function(a) {
|
||||
let x;
|
||||
const sortDate = a.replace(/(<([^>]+)>)/gi, "").trim();
|
||||
if (sortDate !== "") {
|
||||
const dtParts = sortDate.split(" ");
|
||||
const timeParts = (undefined != dtParts[1]) ? dtParts[1].split(":") : ["00", "00", "00"];
|
||||
const dateParts = dtParts[0].split("-");
|
||||
x = (dateParts[0] + dateParts[1] + dateParts[2] + timeParts[0] + timeParts[1] + ((undefined != timeParts[2]) ? timeParts[2] : 0)) * 1;
|
||||
if (isNaN(x)) {
|
||||
x = 0;
|
||||
}
|
||||
} else {
|
||||
x = Infinity;
|
||||
}
|
||||
return x;
|
||||
},
|
||||
|
||||
"date-iso-asc": function(a, b) {
|
||||
return a - b;
|
||||
},
|
||||
|
||||
"date-iso-desc": function(a, b) {
|
||||
return b - a;
|
||||
}
|
||||
});
|
||||
|
||||
const userOrgTypeDialog = document.getElementById("userOrgTypeDialog");
|
||||
// Fill the form and title
|
||||
userOrgTypeDialog.addEventListener("show.bs.modal", function(event) {
|
||||
userOrgTypeDialog.addEventListener("show.bs.modal", function (event) {
|
||||
// Get shared values
|
||||
const userEmail = event.relatedTarget.parentNode.dataset.vwUserEmail;
|
||||
const userUuid = event.relatedTarget.parentNode.dataset.vwUserUuid;
|
||||
@@ -227,7 +199,7 @@ userOrgTypeDialog.addEventListener("show.bs.modal", function(event) {
|
||||
}, false);
|
||||
|
||||
// Prevent accidental submission of the form with valid elements after the modal has been hidden.
|
||||
userOrgTypeDialog.addEventListener("hide.bs.modal", function() {
|
||||
userOrgTypeDialog.addEventListener("hide.bs.modal", function () {
|
||||
document.getElementById("userOrgTypeDialogOrgName").textContent = "";
|
||||
document.getElementById("userOrgTypeDialogUserEmail").textContent = "";
|
||||
document.getElementById("userOrgTypeUserUuid").value = "";
|
||||
@@ -249,7 +221,7 @@ function updateUserOrgType(event) {
|
||||
|
||||
function initUserTable() {
|
||||
// Color all the org buttons per type
|
||||
document.querySelectorAll("button[data-vw-org-type]").forEach(function(e) {
|
||||
document.querySelectorAll("button[data-vw-org-type]").forEach(function (e) {
|
||||
const orgType = ORG_TYPES[e.dataset.vwOrgType];
|
||||
e.style.backgroundColor = orgType.bg;
|
||||
if (orgType.font !== undefined) {
|
||||
@@ -285,12 +257,37 @@ function initUserTable() {
|
||||
}
|
||||
}
|
||||
|
||||
// Special sort function to sort dates in ISO format and have anything else as 0
|
||||
DataTable.ext.type.order["date-iso-pre"] = function (a) {
|
||||
let x;
|
||||
const sortDate = a.replace(/(<([^>]+)>)/gi, "").trim();
|
||||
if (sortDate !== "") {
|
||||
const dtParts = sortDate.split(" ");
|
||||
const timeParts = (undefined != dtParts[1]) ? dtParts[1].split(":") : ["00", "00", "00"];
|
||||
const dateParts = dtParts[0].split("-");
|
||||
x = (dateParts[0] + dateParts[1] + dateParts[2] + timeParts[0] + timeParts[1] + ((undefined != timeParts[2]) ? timeParts[2] : 0)) * 1;
|
||||
if (isNaN(x)) {
|
||||
x = 0;
|
||||
}
|
||||
} else {
|
||||
x = Infinity;
|
||||
}
|
||||
return x;
|
||||
};
|
||||
|
||||
// onLoad events
|
||||
document.addEventListener("DOMContentLoaded", (/*event*/) => {
|
||||
const size = jQuery("#users-table > thead th").length;
|
||||
const ssoOffset = size-7;
|
||||
jQuery("#users-table").DataTable({
|
||||
"drawCallback": function() {
|
||||
DataTable.ext.type.detect.unshift(function (data) {
|
||||
if (typeof data !== "string") { return null; }
|
||||
return data.indexOf("data-sort-type=\"date-iso\"") !== -1
|
||||
? "date-iso"
|
||||
: null;
|
||||
});
|
||||
|
||||
const columnCount = document.getElementById("users-table").querySelectorAll("thead th").length;
|
||||
new DataTable("#users-table", {
|
||||
"typeDetect": true,
|
||||
"drawCallback": function () {
|
||||
initUserTable();
|
||||
},
|
||||
"stateSave": true,
|
||||
@@ -301,10 +298,7 @@ document.addEventListener("DOMContentLoaded", (/*event*/) => {
|
||||
],
|
||||
"pageLength": -1, // Default show all
|
||||
"columnDefs": [{
|
||||
"targets": [1 + ssoOffset, 2 + ssoOffset],
|
||||
"type": "date-iso"
|
||||
}, {
|
||||
"targets": size-1,
|
||||
"targets": columnCount - 1, // Do not include the last column into the search/order features
|
||||
"searchable": false,
|
||||
"orderable": false
|
||||
}]
|
||||
|
||||
Reference in new issue
Block a user