mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
WebAdmin: fix column visibility after reorder
Fixes #1899 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -267,6 +267,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "status",
|
||||
name: "status",
|
||||
render: function(data, type, row) {
|
||||
if (type === 'display') {
|
||||
switch (data){
|
||||
@@ -281,6 +282,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "last_login",
|
||||
name: "last_login",
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
if (type === 'display') {
|
||||
@@ -299,6 +301,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "email",
|
||||
name: "email",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -313,6 +316,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "role",
|
||||
name: "role",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -327,6 +331,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "filters.totp_config",
|
||||
name: "two_factor",
|
||||
visible: false,
|
||||
defaultContent: false,
|
||||
render: function(data, type, row) {
|
||||
@@ -341,6 +346,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "description",
|
||||
name: "description",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -442,10 +448,12 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
$('#table_body').localize();
|
||||
}
|
||||
|
||||
function handleColVisibilityCheckbox(el, index) {
|
||||
function handleColVisibilityCheckbox(el, selector) {
|
||||
let index = dt.column(selector).index();
|
||||
el.off("change");
|
||||
el.prop('checked', dt.column(index).visible());
|
||||
el.on("change", function(e){
|
||||
let index = dt.column(selector).index();
|
||||
dt.column(index).visible($(this).is(':checked'));
|
||||
dt.draw('page');
|
||||
});
|
||||
@@ -458,12 +466,12 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
dt.rows().deselect();
|
||||
dt.search(e.target.value).draw();
|
||||
});
|
||||
handleColVisibilityCheckbox($('#checkColStatus'), 1);
|
||||
handleColVisibilityCheckbox($('#checkColLastLogin'), 2);
|
||||
handleColVisibilityCheckbox($('#checkColEmail'), 3);
|
||||
handleColVisibilityCheckbox($('#checkColRole'), 4);
|
||||
handleColVisibilityCheckbox($('#checkCol2FA'), 5);
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), 6);
|
||||
handleColVisibilityCheckbox($('#checkColStatus'), "status:name");
|
||||
handleColVisibilityCheckbox($('#checkColLastLogin'), "last_login:name");
|
||||
handleColVisibilityCheckbox($('#checkColEmail'), "email:name");
|
||||
handleColVisibilityCheckbox($('#checkColRole'), "role:name");
|
||||
handleColVisibilityCheckbox($('#checkCol2FA'), "two_factor:name");
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), "description:name");
|
||||
|
||||
const exportButton = $(document.querySelector('[data-table-filter="export"]'));
|
||||
exportButton.on('click', function(e){
|
||||
|
||||
@@ -204,6 +204,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "filesystem.provider",
|
||||
name: "storage",
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
if (type === 'display') {
|
||||
@@ -229,6 +230,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "used_quota_size",
|
||||
name: "quota",
|
||||
visible: false,
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
@@ -249,6 +251,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "users",
|
||||
name: "associations",
|
||||
defaultContent: "",
|
||||
visible: false,
|
||||
searchable: false,
|
||||
@@ -270,6 +273,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "description",
|
||||
name: "description",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -362,10 +366,12 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
$('#table_body').localize();
|
||||
}
|
||||
|
||||
function handleColVisibilityCheckbox(el, index) {
|
||||
function handleColVisibilityCheckbox(el, selector) {
|
||||
let index = dt.column(selector).index();
|
||||
el.off("change");
|
||||
el.prop('checked', dt.column(index).visible());
|
||||
el.on("change", function(e){
|
||||
let index = dt.column(selector).index();
|
||||
dt.column(index).visible($(this).is(':checked'));
|
||||
dt.draw('page');
|
||||
});
|
||||
@@ -378,10 +384,10 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
dt.rows().deselect();
|
||||
dt.search(e.target.value).draw();
|
||||
});
|
||||
handleColVisibilityCheckbox($('#checkColStorage'), 1);
|
||||
handleColVisibilityCheckbox($('#checkColQuota'), 2);
|
||||
handleColVisibilityCheckbox($('#checkColAssociations'), 3);
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), 4);
|
||||
handleColVisibilityCheckbox($('#checkColStorage'), "storage:name");
|
||||
handleColVisibilityCheckbox($('#checkColQuota'), "quota:name");
|
||||
handleColVisibilityCheckbox($('#checkColAssociations'), "associations:name");
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), "description:name");
|
||||
|
||||
const exportButton = $(document.querySelector('[data-table-filter="export"]'));
|
||||
exportButton.on('click', function(e){
|
||||
|
||||
@@ -190,6 +190,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "users",
|
||||
name: "members",
|
||||
defaultContent: "",
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
@@ -210,6 +211,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "description",
|
||||
name: "description",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -299,10 +301,12 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
$('#table_body').localize();
|
||||
}
|
||||
|
||||
function handleColVisibilityCheckbox(el, index) {
|
||||
function handleColVisibilityCheckbox(el, selector) {
|
||||
let index = dt.column(selector).index();
|
||||
el.off("change");
|
||||
el.prop('checked', dt.column(index).visible());
|
||||
el.on("change", function(e){
|
||||
let index = dt.column(selector).index();
|
||||
dt.column(index).visible($(this).is(':checked'));
|
||||
dt.draw('page');
|
||||
});
|
||||
@@ -315,8 +319,8 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
dt.rows().deselect();
|
||||
dt.search(e.target.value).draw();
|
||||
});
|
||||
handleColVisibilityCheckbox($('#checkColMembers'), 1);
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), 2);
|
||||
handleColVisibilityCheckbox($('#checkColMembers'), "members:name");
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), "description:name");
|
||||
|
||||
const exportButton = $(document.querySelector('[data-table-filter="export"]'));
|
||||
exportButton.on('click', function(e){
|
||||
|
||||
@@ -191,6 +191,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "users",
|
||||
name: "members",
|
||||
defaultContent: "",
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
@@ -211,6 +212,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "description",
|
||||
name: "description",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -300,10 +302,12 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
$('#table_body').localize();
|
||||
}
|
||||
|
||||
function handleColVisibilityCheckbox(el, index) {
|
||||
function handleColVisibilityCheckbox(el, selector) {
|
||||
let index = dt.column(selector).index();
|
||||
el.off("change");
|
||||
el.prop('checked', dt.column(index).visible());
|
||||
el.on("change", function(e){
|
||||
let index = dt.column(selector).index();
|
||||
dt.column(index).visible($(this).is(':checked'));
|
||||
dt.draw('page');
|
||||
});
|
||||
@@ -316,8 +320,8 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
dt.rows().deselect();
|
||||
dt.search(e.target.value).draw();
|
||||
});
|
||||
handleColVisibilityCheckbox($('#checkColMembers'), 1);
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), 2);
|
||||
handleColVisibilityCheckbox($('#checkColMembers'), "members:name");
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), "description:name");
|
||||
|
||||
const exportButton = $(document.querySelector('[data-table-filter="export"]'));
|
||||
exportButton.on('click', function(e){
|
||||
|
||||
@@ -319,6 +319,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "status",
|
||||
name: "status",
|
||||
render: function(data, type, row) {
|
||||
let result = data;
|
||||
if (row.expiration_date){
|
||||
@@ -341,6 +342,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "last_login",
|
||||
name: "last_login",
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
if (type === 'display') {
|
||||
@@ -359,6 +361,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "email",
|
||||
name: "email",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -373,6 +376,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "filesystem.provider",
|
||||
name: "storage",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -399,6 +403,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "role",
|
||||
name: "role",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -413,6 +418,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "filters.totp_config",
|
||||
name: "two_factor",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -430,6 +436,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "quota_files",
|
||||
name: "disk_quota",
|
||||
visible: false,
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
@@ -464,6 +471,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "total_data_transfer",
|
||||
name: "transfer_quota",
|
||||
visible: false,
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
@@ -509,6 +517,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "groups",
|
||||
name: "groups",
|
||||
visible: false,
|
||||
defaultContent: [],
|
||||
render: function(data, type, row) {
|
||||
@@ -626,10 +635,12 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
$('#table_body').localize();
|
||||
}
|
||||
|
||||
function handleColVisibilityCheckbox(el, index) {
|
||||
function handleColVisibilityCheckbox(el, selector) {
|
||||
let index = dt.column(selector).index();
|
||||
el.off("change");
|
||||
el.prop('checked', dt.column(index).visible());
|
||||
el.on("change", function(e){
|
||||
let index = dt.column(selector).index();
|
||||
dt.column(index).visible($(this).is(':checked'));
|
||||
dt.draw('page');
|
||||
});
|
||||
@@ -642,15 +653,15 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
dt.rows().deselect();
|
||||
dt.search(e.target.value).draw();
|
||||
});
|
||||
handleColVisibilityCheckbox($('#checkColStatus'), 1);
|
||||
handleColVisibilityCheckbox($('#checkColLastLogin'), 2);
|
||||
handleColVisibilityCheckbox($('#checkColEmail'), 3);
|
||||
handleColVisibilityCheckbox($('#checkColStorage'), 4);
|
||||
handleColVisibilityCheckbox($('#checkColRole'), 5);
|
||||
handleColVisibilityCheckbox($('#checkCol2FA'), 6);
|
||||
handleColVisibilityCheckbox($('#checkColDiskQuota'), 7);
|
||||
handleColVisibilityCheckbox($('#checkColTransferQuota'), 8);
|
||||
handleColVisibilityCheckbox($('#checkColGroups'), 9);
|
||||
handleColVisibilityCheckbox($('#checkColStatus'), "status:name");
|
||||
handleColVisibilityCheckbox($('#checkColLastLogin'), "last_login:name");
|
||||
handleColVisibilityCheckbox($('#checkColEmail'), "email:name");
|
||||
handleColVisibilityCheckbox($('#checkColStorage'), "storage:name");
|
||||
handleColVisibilityCheckbox($('#checkColRole'), "role:name");
|
||||
handleColVisibilityCheckbox($('#checkCol2FA'), "two_factor:name");
|
||||
handleColVisibilityCheckbox($('#checkColDiskQuota'), "disk_quota:name");
|
||||
handleColVisibilityCheckbox($('#checkColTransferQuota'), "transfer_quota:name");
|
||||
handleColVisibilityCheckbox($('#checkColGroups'), "groups:name");
|
||||
|
||||
const exportButton = $(document.querySelector('[data-table-filter="export"]'));
|
||||
exportButton.on('click', function(e){
|
||||
|
||||
Reference in New Issue
Block a user