Commit a653606a authored by Piotr Gawron's avatar Piotr Gawron
Browse files

update of annotator list was skipped

parent 856b23e1
Pipeline #37330 passed with stage
in 19 minutes and 50 seconds
......@@ -2,6 +2,8 @@ minerva (15.1.3) stable; urgency=medium
* Bug fix: modifier reactions to phenotype were incorrectly translated to
Process Description reactions when exporting to SBGN-ML (#1445)
* Bug fix: AND/OR text was missing when drawing diagram as SBGN (#1428)
* Bug fix: annotators details changes were not saved in few consecutive
updates (#1446)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 8 Feb 2021 12:00:00 +0200
......
......@@ -76,7 +76,10 @@ ChooseAnnotatorsDialog.prototype.createGui = function () {
ChooseAnnotatorsDialog.prototype.onChangeParameterValue = function (element, annotatorParameter, annotator) {
var self = this;
GuiConnector.showProcessing();
return self.getServerConnector().getLoggedUser().then(function (user) {
var elementType = undefined;
var user;
return self.getServerConnector().getLoggedUser().then(function (data) {
user = data;
if (annotatorParameter.getType() === "CONFIG") {
if (element.type === 'checkbox') {
annotator.setParameterValue(annotatorParameter, element.checked.toString());
......@@ -90,11 +93,33 @@ ChooseAnnotatorsDialog.prototype.onChangeParameterValue = function (element, ann
annotator.removeParameter(annotatorParameter);
}
}
for (var key in user.getPreferences()._elementAnnotators) {
if (user.getPreferences()._elementAnnotators.hasOwnProperty(key)) {
var annotators = user.getPreferences()._elementAnnotators[key];
for (var i = 0; i < annotators.length; i++) {
if (annotators[i] === annotator) {
elementType = key;
}
}
}
}
return self.getServerConnector().updateUserPreferences({
user: user,
preferences: user.getPreferences()
});
}).then(function () {
//this is very hacky - it's due to bug in updating data from server when updatePreferences is finished
//if we don't do it later changes will not be applied (https://git-r3lab.uni.lu/minerva/core/-/issues/1446)
var annotators = user.getPreferences()._elementAnnotators[elementType];
if (annotators !== undefined) {
for (var i = 0; i < annotators.length; i++) {
if (annotators[i]._className === annotator._className) {
annotators[i] = annotator;
}
}
}
}).catch(GuiConnector.alert).finally(function () {
GuiConnector.hideProcessing();
});
};
......
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