Commit 242a377a authored by Piotr Gawron's avatar Piotr Gawron
Browse files

order in databasle is preserved in user preferences

parent 4e9c3f5e
minerva (15.0.0~alpha.1) stable; urgency=medium
* Small improvement: sort order of tables in admin panel is preserved among
sessions (#836)
minerva (15.0.0~alpha.0) stable; urgency=medium minerva (15.0.0~alpha.0) stable; urgency=medium
* Improvement: logs provided for validation data model are structurized (#325) * Improvement: logs provided for validation data model are structurized (#325)
* Improvement: import/export of GPML implemented * Improvement: import/export of GPML implemented
...@@ -19,6 +23,8 @@ minerva (15.0.0~alpha.0) stable; urgency=medium ...@@ -19,6 +23,8 @@ minerva (15.0.0~alpha.0) stable; urgency=medium
file (#671) file (#671)
* Bug fix: problematic notes doesn't crash CellDesigner upload (#968) * Bug fix: problematic notes doesn't crash CellDesigner upload (#968)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 4 Nov 2019 11:00:00 +0200
minerva (14.0.3) stable; urgency=medium minerva (14.0.3) stable; urgency=medium
* Bug fix: default zoom level on main map works even when x or y are * Bug fix: default zoom level on main map works even when x or y are
undefined (#993) undefined (#993)
......
...@@ -141,7 +141,7 @@ ConfigurationAdminPanel.prototype.createOptionsTable = function (options, type) ...@@ -141,7 +141,7 @@ ConfigurationAdminPanel.prototype.createOptionsTable = function (options, type)
self.getGuiUtils().addTab(self, {name: type, content: configurationDiv}); self.getGuiUtils().addTab(self, {name: type, content: configurationDiv});
return self.bindUserGuiPreference({ return Promise.all([self.bindUserGuiPreference({
jQueryObject: $(configurationTable), jQueryObject: $(configurationTable),
event: 'length.dt', event: 'length.dt',
preferenceName: 'admin-configuration-datatable-length', preferenceName: 'admin-configuration-datatable-length',
...@@ -152,7 +152,26 @@ ConfigurationAdminPanel.prototype.createOptionsTable = function (options, type) ...@@ -152,7 +152,26 @@ ConfigurationAdminPanel.prototype.createOptionsTable = function (options, type)
setter: function (value) { setter: function (value) {
return $(configurationTable).DataTable().page.len(value).draw(); return $(configurationTable).DataTable().page.len(value).draw();
} }
}); }), self.bindUserGuiPreference({
jQueryObject: $(configurationTable),
event: 'order.dt',
preferenceName: 'admin-configuration-' + type + '-datatable-order',
defaultValue: '0-asc',
getter: function () {
var order = $(configurationTable).DataTable().order();
return order[0][0] + "-" + order[0][1];
},
setter: function (value) {
var tmp = value.split("-");
var column = parseInt(tmp[0]);
var order = tmp[1];
if (Functions.isInt(column) && (order === "asc" || order === "desc")) {
return $(configurationTable).DataTable().order([column, order]).draw();
} else {
logger.warn("Invalid order: " + column + "; " + order);
}
}
})]);
}; };
/** /**
......
...@@ -177,6 +177,30 @@ GenomeAdminPanel.prototype.init = function () { ...@@ -177,6 +177,30 @@ GenomeAdminPanel.prototype.init = function () {
} else { } else {
self.disablePanel("You have no privilege to manage genomes"); self.disablePanel("You have no privilege to manage genomes");
} }
}).then(function () {
var genomesTable = $("[name='genomeTable']", self.getElement())[0];
return self.bindUserGuiPreference({
jQueryObject: $(genomesTable),
event: 'order.dt',
preferenceName: 'admin-genome-datatable-order',
defaultValue: '0-asc',
getter: function () {
var order = $(genomesTable).DataTable().order();
return order[0][0] + "-" + order[0][1];
},
setter: function (value) {
var tmp = value.split("-");
var column = parseInt(tmp[0]);
var order = tmp[1];
if (Functions.isInt(column) && (order === "asc" || order === "desc")) {
return $(genomesTable).DataTable().order([column, order]).draw();
} else {
logger.warn("Invalid order: " + column + "; " + order);
}
}
});
}); });
}; };
...@@ -267,7 +291,7 @@ GenomeAdminPanel.prototype.destroy = function () { ...@@ -267,7 +291,7 @@ GenomeAdminPanel.prototype.destroy = function () {
/** /**
* *
* @param {ReferenceGenome} [genome] * @param {ReferenceGenome} [genome]
* @returns {Promise} * @returns {Promise<EditGenomeDialog>}
*/ */
GenomeAdminPanel.prototype.getDialog = function (genome) { GenomeAdminPanel.prototype.getDialog = function (genome) {
var self = this; var self = this;
......
...@@ -150,6 +150,29 @@ PluginAdminPanel.prototype.init = function () { ...@@ -150,6 +150,29 @@ PluginAdminPanel.prototype.init = function () {
} else { } else {
self.disablePanel("You have no privilege to manage plugins"); self.disablePanel("You have no privilege to manage plugins");
} }
}).then(function () {
var pluginsTable = $("[name='pluginsTable']", self.getElement())[0];
return self.bindUserGuiPreference({
jQueryObject: $(pluginsTable),
event: 'order.dt',
preferenceName: 'admin-plugins-datatable-order',
defaultValue: '0-asc',
getter: function () {
var order = $(pluginsTable).DataTable().order();
return order[0][0] + "-" + order[0][1];
},
setter: function (value) {
var tmp = value.split("-");
var column = parseInt(tmp[0]);
var order = tmp[1];
if (Functions.isInt(column) && (order === "asc" || order === "desc")) {
return $(pluginsTable).DataTable().order([column, order]).draw();
} else {
logger.warn("Invalid order: " + column + "; " + order);
}
}
});
}); });
}; };
......
...@@ -265,6 +265,30 @@ UsersAdminPanel.prototype.init = function () { ...@@ -265,6 +265,30 @@ UsersAdminPanel.prototype.init = function () {
} else { } else {
self.disablePanel("You have no privilege to manage users"); self.disablePanel("You have no privilege to manage users");
} }
}).then(function () {
var usersTable = $("[name='usersTable']", self.getElement())[0];
return self.bindUserGuiPreference({
jQueryObject: $(usersTable),
event: 'order.dt',
preferenceName: 'admin-users-datatable-order',
defaultValue: '0-asc',
getter: function () {
var order = $(usersTable).DataTable().order();
return order[0][0] + "-" + order[0][1];
},
setter: function (value) {
var tmp = value.split("-");
var column = parseInt(tmp[0]);
var order = tmp[1];
if (Functions.isInt(column) && (order === "asc" || order === "desc")) {
return $(usersTable).DataTable().order([column, order]).draw();
} else {
logger.warn("Invalid order: " + column + "; " + order);
}
}
});
}); });
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment