Commit 8af59861 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

updting preferences is blocking UI so two parallel changes cannot be executed

parent c31bae29
minerva (12.2.0~beta.2) unstable; urgency=medium
* Bug fix: changes in selected checkbox in add project dialog block UI (#726)
* Bug fix: providing invalid overlay id in url could break minerva (#726)
* Bug fix: Editing project with images and submaps could cause a problem
(#725)
......
......@@ -797,10 +797,14 @@ AddProjectDialog.prototype.bindProjectUploadPreferences = function (user, type,
var value = user.getPreferences().getProjectUpload()[type];
element.prop('checked', value);
GuiConnector.showProcessing();
element.change(function () {
var data = new UserPreferences();
data.getProjectUpload()[type] = element.is(":checked");
return ServerConnector.updateUserPreferences({user: user, preferences: data}).then(null, GuiConnector.alert);
return ServerConnector.updateUserPreferences({
user: user,
preferences: data
}).finally(GuiConnector.hideProcessing).catch(GuiConnector.alert);
});
};
......
......@@ -77,7 +77,11 @@ function onChangeParameterValue(element, user) {
else annotatorsParams[annotatorClassName][name] = element.value;
data.setAnnotatorsParameters(annotatorsParams);
return ServerConnector.updateUserPreferences({user: user, preferences: data}).then(null, GuiConnector.alert);
GuiConnector.showProcessing();
return ServerConnector.updateUserPreferences({
user: user,
preferences: data
}).finally(GuiConnector.hideProcessing).catch(GuiConnector.alert);
}
/**
......@@ -88,6 +92,7 @@ function onChangeParameterValue(element, user) {
*/
ChooseAnnotatorsDialog.prototype.saveAnnotatorsInfo = function (elementTypes, selectedAnnotators) {
selectedAnnotators = selectedAnnotators.slice();
GuiConnector.showProcessing();
return ServerConnector.getLoggedUser().then(function (user) {
var data = new UserPreferences();
......@@ -105,7 +110,7 @@ ChooseAnnotatorsDialog.prototype.saveAnnotatorsInfo = function (elementTypes, se
user: user,
preferences: data
});
}).catch(GuiConnector.alert);
}).finally(GuiConnector.hideProcessing).catch(GuiConnector.alert);
};
/**
......
......@@ -160,6 +160,7 @@ ChooseValidatorsDialog.prototype.saveAnnotationsInfo = function (params) {
var requiredAnnotators = params.requiredAnnotators;
var validAnnotators = params.validAnnotators;
var self = this;
GuiConnector.showProcessing();
return self.getServerConnector().getLoggedUser().then(function (user) {
var data = new UserPreferences();
......@@ -179,7 +180,7 @@ ChooseValidatorsDialog.prototype.saveAnnotationsInfo = function (params) {
user: user,
preferences: data
});
}).catch(GuiConnector.alert);
}).finally(GuiConnector.hideProcessing).catch(GuiConnector.alert);
};
......@@ -241,10 +242,11 @@ ChooseValidatorsDialog.prototype.createValidAnnotationsDualListBox = function (u
var elementAnnotators = {};
elementAnnotators[elementType.className] = validAnnotations;
data.setElementValidAnnotations(elementAnnotators);
GuiConnector.showProcessing();
return self.getServerConnector().updateUserPreferences({
user: user,
preferences: data
}).catch(GuiConnector.alert);
}).finally(GuiConnector.hideProcessing).catch(GuiConnector.alert);
};
checkboxList.addListener("select", function (element) {
......@@ -282,7 +284,11 @@ ChooseValidatorsDialog.prototype.createVerifyAnnotationsDualListBox = function (
"annotation-list": requiredAnnotationsData.list
};
data.setElementRequiredAnnotations(elementRequiredAnnotations);
return self.getServerConnector().updateUserPreferences({user: user, preferences: data}).catch(GuiConnector.alert);
GuiConnector.showProcessing();
return self.getServerConnector().updateUserPreferences({
user: user,
preferences: data
}).finally(GuiConnector.hideProcessing).catch(GuiConnector.alert);
}
});
checkbox.checked = requiredAnnotationsData.requiredAtLeastOnce;
......@@ -343,7 +349,11 @@ ChooseValidatorsDialog.prototype.createVerifyAnnotationsDualListBox = function (
"annotation-list": requiredAnnotationsData.list
};
data.setElementRequiredAnnotations(elementRequiredAnnotations);
return self.getServerConnector().updateUserPreferences({user: user, preferences: data}).catch(GuiConnector.alert);
GuiConnector.showProcessing();
return self.getServerConnector().updateUserPreferences({
user: user,
preferences: data
}).finally(GuiConnector.hideProcessing).catch(GuiConnector.alert);
};
checkboxList.addListener("select", function (element) {
......
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