aboutsummaryrefslogtreecommitdiff
path: root/src/static/scripts
diff options
context:
space:
mode:
authorDaniel García <[email protected]>2023-02-28 23:43:01 +0100
committerGitHub <[email protected]>2023-02-28 23:43:01 +0100
commit4556f668de64dc45176d8bd6f55a92c6acbb6ea8 (patch)
treeaf2fe741193d87ee1e8cb9a0c0d6bccac3911629 /src/static/scripts
parentda8225a3bdca659d061a696ffacac909791482dd (diff)
parentf10e6b6ac2edbdaab3b4ddad1328ef77c65ba02c (diff)
downloadvaultwarden-4556f668de64dc45176d8bd6f55a92c6acbb6ea8.tar.gz
vaultwarden-4556f668de64dc45176d8bd6f55a92c6acbb6ea8.zip
Merge pull request #3288 from BlackDex/admin-interface-updates
Some Admin Interface updates
Diffstat (limited to 'src/static/scripts')
-rw-r--r--src/static/scripts/admin.css6
-rw-r--r--src/static/scripts/admin_diagnostics.js32
-rw-r--r--src/static/scripts/admin_organizations.js2
-rw-r--r--src/static/scripts/admin_users.js2
-rw-r--r--src/static/scripts/datatables.css29
-rw-r--r--src/static/scripts/datatables.js64
6 files changed, 96 insertions, 39 deletions
diff --git a/src/static/scripts/admin.css b/src/static/scripts/admin.css
index 67f2c00d..d700af3c 100644
--- a/src/static/scripts/admin.css
+++ b/src/static/scripts/admin.css
@@ -25,10 +25,14 @@ img {
min-width: 85px;
max-width: 85px;
}
-#users-table .vw-items, #orgs-table .vw-items, #orgs-table .vw-users {
+#users-table .vw-ciphers, #orgs-table .vw-users, #orgs-table .vw-ciphers {
min-width: 35px;
max-width: 40px;
}
+#orgs-table .vw-misc {
+ min-width: 65px;
+ max-width: 80px;
+}
#users-table .vw-attachments, #orgs-table .vw-attachments {
min-width: 100px;
max-width: 130px;
diff --git a/src/static/scripts/admin_diagnostics.js b/src/static/scripts/admin_diagnostics.js
index a7a574fc..5fbed2da 100644
--- a/src/static/scripts/admin_diagnostics.js
+++ b/src/static/scripts/admin_diagnostics.js
@@ -4,6 +4,7 @@
var dnsCheck = false;
var timeCheck = false;
+var ntpTimeCheck = false;
var domainCheck = false;
var httpsCheck = false;
@@ -90,7 +91,8 @@ async function generateSupportString(event, dj) {
supportString += `* Internet access: ${dj.has_http_access}\n`;
supportString += `* Internet access via a proxy: ${dj.uses_proxy}\n`;
supportString += `* DNS Check: ${dnsCheck}\n`;
- supportString += `* Time Check: ${timeCheck}\n`;
+ supportString += `* Browser/Server Time Check: ${timeCheck}\n`;
+ supportString += `* Server/NTP Time Check: ${ntpTimeCheck}\n`;
supportString += `* Domain Configuration Check: ${domainCheck}\n`;
supportString += `* HTTPS Check: ${httpsCheck}\n`;
supportString += `* Database type: ${dj.db_type}\n`;
@@ -136,16 +138,17 @@ function copyToClipboard(event) {
new BSN.Toast("#toastClipboardCopy").show();
}
-function checkTimeDrift(browserUTC, serverUTC) {
+function checkTimeDrift(utcTimeA, utcTimeB, statusPrefix) {
const timeDrift = (
- Date.parse(serverUTC.replace(" ", "T").replace(" UTC", "")) -
- Date.parse(browserUTC.replace(" ", "T").replace(" UTC", ""))
+ Date.parse(utcTimeA.replace(" ", "T").replace(" UTC", "")) -
+ Date.parse(utcTimeB.replace(" ", "T").replace(" UTC", ""))
) / 1000;
- if (timeDrift > 20 || timeDrift < -20) {
- document.getElementById("time-warning").classList.remove("d-none");
+ if (timeDrift > 15 || timeDrift < -15) {
+ document.getElementById(`${statusPrefix}-warning`).classList.remove("d-none");
+ return false;
} else {
- document.getElementById("time-success").classList.remove("d-none");
- timeCheck = true;
+ document.getElementById(`${statusPrefix}-success`).classList.remove("d-none");
+ return true;
}
}
@@ -195,7 +198,18 @@ function checkDns(dns_resolved) {
function init(dj) {
// Time check
document.getElementById("time-browser-string").innerText = browserUTC;
- checkTimeDrift(browserUTC, dj.server_time);
+
+ // Check if we were able to fetch a valid NTP Time
+ // If so, compare both browser and server with NTP
+ // Else, compare browser and server.
+ if (dj.ntp_time.indexOf("UTC") !== -1) {
+ timeCheck = checkTimeDrift(dj.server_time, browserUTC, "time");
+ checkTimeDrift(dj.ntp_time, browserUTC, "ntp-browser");
+ ntpTimeCheck = checkTimeDrift(dj.ntp_time, dj.server_time, "ntp-server");
+ } else {
+ timeCheck = checkTimeDrift(dj.server_time, browserUTC, "time");
+ ntpTimeCheck = "n/a";
+ }
// Domain check
const browserURL = location.href.toLowerCase();
diff --git a/src/static/scripts/admin_organizations.js b/src/static/scripts/admin_organizations.js
index db4037b4..c885344e 100644
--- a/src/static/scripts/admin_organizations.js
+++ b/src/static/scripts/admin_organizations.js
@@ -54,7 +54,7 @@ document.addEventListener("DOMContentLoaded", (/*event*/) => {
],
"pageLength": -1, // Default show all
"columnDefs": [{
- "targets": 4,
+ "targets": [4,5],
"searchable": false,
"orderable": false
}]
diff --git a/src/static/scripts/admin_users.js b/src/static/scripts/admin_users.js
index 8f947d5d..cdc6c3f4 100644
--- a/src/static/scripts/admin_users.js
+++ b/src/static/scripts/admin_users.js
@@ -244,7 +244,7 @@ document.addEventListener("DOMContentLoaded", (/*event*/) => {
[-1, 2, 5, 10, 25, 50],
["All", 2, 5, 10, 25, 50]
],
- "pageLength": 2, // Default show all
+ "pageLength": -1, // Default show all
"columnDefs": [{
"targets": [1, 2],
"type": "date-iso"
diff --git a/src/static/scripts/datatables.css b/src/static/scripts/datatables.css
index a19cb110..d22b2250 100644
--- a/src/static/scripts/datatables.css
+++ b/src/static/scripts/datatables.css
@@ -4,13 +4,19 @@
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
- * https://datatables.net/download/#bs5/dt-1.13.1
+ * https://datatables.net/download/#bs5/dt-1.13.2
*
* Included libraries:
- * DataTables 1.13.1
+ * DataTables 1.13.2
*/
@charset "UTF-8";
+:root {
+ --dt-row-selected: 13, 110, 253;
+ --dt-row-selected-text: 255, 255, 255;
+ --dt-row-selected-link: 9, 10, 11;
+}
+
table.dataTable td.dt-control {
text-align: center;
cursor: pointer;
@@ -126,7 +132,7 @@ div.dataTables_processing > div:last-child > div {
width: 13px;
height: 13px;
border-radius: 50%;
- background: rgba(13, 110, 253, 0.9);
+ background: 13 110 253;
animation-timing-function: cubic-bezier(0, 1, 1, 0);
}
div.dataTables_processing > div:last-child > div:nth-child(1) {
@@ -284,23 +290,28 @@ table.dataTable > tbody > tr {
background-color: transparent;
}
table.dataTable > tbody > tr.selected > * {
- box-shadow: inset 0 0 0 9999px rgba(13, 110, 253, 0.9);
- color: white;
+ box-shadow: inset 0 0 0 9999px rgb(13, 110, 253);
+ box-shadow: inset 0 0 0 9999px rgb(var(--dt-row-selected));
+ color: rgb(255, 255, 255);
+ color: rgb(var(--dt-row-selected-text));
}
table.dataTable > tbody > tr.selected a {
- color: #090a0b;
+ color: rgb(9, 10, 11);
+ color: rgb(var(--dt-row-selected-link));
}
table.dataTable.table-striped > tbody > tr.odd > * {
box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.05);
}
table.dataTable.table-striped > tbody > tr.odd.selected > * {
box-shadow: inset 0 0 0 9999px rgba(13, 110, 253, 0.95);
+ box-shadow: inset 0 0 0 9999px rgba(var(--dt-row-selected), 0.95);
}
table.dataTable.table-hover > tbody > tr:hover > * {
box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.075);
}
table.dataTable.table-hover > tbody > tr.selected:hover > * {
box-shadow: inset 0 0 0 9999px rgba(13, 110, 253, 0.975);
+ box-shadow: inset 0 0 0 9999px rgba(var(--dt-row-selected), 0.975);
}
div.dataTables_wrapper div.dataTables_length label {
@@ -374,9 +385,9 @@ div.dataTables_scrollFoot > .dataTables_scrollFootInner > table {
@media screen and (max-width: 767px) {
div.dataTables_wrapper div.dataTables_length,
-div.dataTables_wrapper div.dataTables_filter,
-div.dataTables_wrapper div.dataTables_info,
-div.dataTables_wrapper div.dataTables_paginate {
+ div.dataTables_wrapper div.dataTables_filter,
+ div.dataTables_wrapper div.dataTables_info,
+ div.dataTables_wrapper div.dataTables_paginate {
text-align: center;
}
div.dataTables_wrapper div.dataTables_paginate ul.pagination {
diff --git a/src/static/scripts/datatables.js b/src/static/scripts/datatables.js
index 1aeda982..9854358e 100644
--- a/src/static/scripts/datatables.js
+++ b/src/static/scripts/datatables.js
@@ -4,20 +4,20 @@
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
- * https://datatables.net/download/#bs5/dt-1.13.1
+ * https://datatables.net/download/#bs5/dt-1.13.2
*
* Included libraries:
- * DataTables 1.13.1
+ * DataTables 1.13.2
*/
-/*! DataTables 1.13.1
- * ©2008-2022 SpryMedia Ltd - datatables.net/license
+/*! DataTables 1.13.2
+ * ©2008-2023 SpryMedia Ltd - datatables.net/license
*/
/**
* @summary DataTables
* @description Paginate, search and order HTML tables
- * @version 1.13.1
+ * @version 1.13.2
* @author SpryMedia Ltd
* @contact www.datatables.net
* @copyright SpryMedia Ltd.
@@ -1382,7 +1382,12 @@
var _isNumber = function ( d, decimalPoint, formatted ) {
- var strType = typeof d === 'string';
+ let type = typeof d;
+ var strType = type === 'string';
+
+ if ( type === 'number' || type === 'bigint') {
+ return true;
+ }
// If empty return immediately so there must be a number if it is a
// formatted string (this stops the string "k", or "kr", etc being detected
@@ -6789,8 +6794,15 @@
if ( eventName !== null ) {
var e = $.Event( eventName+'.dt' );
+ var table = $(settings.nTable);
- $(settings.nTable).trigger( e, args );
+ table.trigger( e, args );
+
+ // If not yet attached to the document, trigger the event
+ // on the body directly to sort of simulate the bubble
+ if (table.parents('body').length === 0) {
+ $('body').trigger( e, args );
+ }
ret.push( e.result );
}
@@ -7256,7 +7268,7 @@
pluck: function ( prop )
{
- let fn = DataTable.util.get(prop);
+ var fn = DataTable.util.get(prop);
return this.map( function ( el ) {
return fn(el);
@@ -8353,10 +8365,9 @@
$(document).on('plugin-init.dt', function (e, context) {
var api = new _Api( context );
-
- const namespace = 'on-plugin-init';
- const stateSaveParamsEvent = `stateSaveParams.${namespace}`;
- const destroyEvent = `destroy.${namespace}`;
+ var namespace = 'on-plugin-init';
+ var stateSaveParamsEvent = 'stateSaveParams.' + namespace;
+ var destroyEvent = 'destroy. ' + namespace;
api.on( stateSaveParamsEvent, function ( e, settings, d ) {
// This could be more compact with the API, but it is a lot faster as a simple
@@ -8375,7 +8386,7 @@
});
api.on( destroyEvent, function () {
- api.off(`${stateSaveParamsEvent} ${destroyEvent}`);
+ api.off(stateSaveParamsEvent + ' ' + destroyEvent);
});
var loaded = api.state.loaded();
@@ -9697,7 +9708,7 @@
* @type string
* @default Version number
*/
- DataTable.version = "1.13.1";
+ DataTable.version = "1.13.2";
/**
* Private data store, containing all of the settings objects that are
@@ -14121,7 +14132,7 @@
*
* @type string
*/
- build:"bs5/dt-1.13.1",
+ build:"bs5/dt-1.13.2",
/**
@@ -14830,10 +14841,17 @@
}
if ( btnDisplay !== null ) {
- node = $('<a>', {
+ var tag = settings.oInit.pagingTag || 'a';
+ var disabled = btnClass.indexOf(disabledClass) !== -1;
+
+
+ node = $('<'+tag+'>', {
'class': classes.sPageButton+' '+btnClass,
'aria-controls': settings.sTableId,
+ 'aria-disabled': disabled ? 'true' : null,
'aria-label': aria[ button ],
+ 'aria-role': 'link',
+ 'aria-current': btnClass === classes.sPageButtonActive ? 'page' : null,
'data-dt-idx': button,
'tabindex': tabIndex,
'id': idx === 0 && typeof button === 'string' ?
@@ -14965,6 +14983,12 @@
if ( d !== 0 && (!d || d === '-') ) {
return -Infinity;
}
+
+ let type = typeof d;
+
+ if (type === 'number' || type === 'bigint') {
+ return d;
+ }
// If a decimal place other than `.` is used, it needs to be given to the
// function so we can detect it and replace with a `.` which is the only
@@ -15647,7 +15671,6 @@
require('datatables.net')(root, $);
}
-
return factory( $, root, root.document );
};
}
@@ -15755,6 +15778,8 @@ DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, bu
}
if ( btnDisplay ) {
+ var disabled = btnClass.indexOf('disabled') !== -1;
+
node = $('<li>', {
'class': classes.sPageButton+' '+btnClass,
'id': idx === 0 && typeof button === 'string' ?
@@ -15762,9 +15787,12 @@ DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, bu
null
} )
.append( $('<a>', {
- 'href': '#',
+ 'href': disabled ? null : '#',
'aria-controls': settings.sTableId,
+ 'aria-disabled': disabled ? 'true' : null,
'aria-label': aria[ button ],
+ 'aria-role': 'link',
+ 'aria-current': btnClass === 'active' ? 'page' : null,
'data-dt-idx': button,
'tabindex': settings.iTabIndex,
'class': 'page-link'