Commit 08b819e3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'devel_11.1.x-clean'

parents 401e56a2 700c470b
......@@ -123,6 +123,13 @@ minerva (12.0.0~alpha.0) unstable; urgency=medium
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 21 Feb 2018 12:00:00 +0200
minerva (11.1.2) stable; urgency=medium
* Bug fix: Searching for chemicals with invalid mesh ID crashed
* Bug fix: opening map that was removed and re-uploaded could crash
* warning message due to lack of google consent improved
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 04 Jul 2018 16:00:00 +0200
minerva (11.1.1) stable; urgency=medium
* Bug fix: Updating privileges takes much less time
* Bug fix: Concurent update on privileges shouldn't crash anymore
......
......@@ -298,6 +298,9 @@ GuiConnector.prototype.destroy = function () {
if (self._infoDialog !== undefined) {
$(self._infoDialog).dialog("destroy").remove();
}
if (self._warnDialog !== undefined) {
$(self._warnDialog).dialog("destroy").remove();
}
if (self._processingDialog !== undefined) {
$(self._processingDialog).dialog("destroy").remove();
}
......@@ -316,3 +319,24 @@ GuiConnector.singleton = new GuiConnector();
module.exports = GuiConnector.singleton;
GuiConnector.warn = function (message) {
var self = GuiConnector;
logger.warn(message);
if (self._warnDialog === undefined) {
self._warnDialog = document.createElement("div");
self._warnDialogContent = document.createElement("div");
self._warnDialog.appendChild(self._warnDialogContent);
document.body.appendChild(self._warnDialog);
$(self._warnDialog).dialog({
classes: {
"ui-dialog": "ui-state-highlight"
},
modal: true,
title: "WARNING"
});
}
self._warnDialogContent.innerHTML = message;
$(self._warnDialog).dialog("open");
};
module.exports = GuiConnector;
......@@ -237,7 +237,17 @@ OverlayPanel.prototype.createOverlayRow = function (overlay, checked, disabled)
});
checkbox.checked = checked;
$(checkbox).prop("disabled", disabled);
viewTd.appendChild(checkbox);
if (disabled) {
var warningDiv = Functions.createElement({
type: "div",
content: "<i class='fa fa-exclamation-triangle' style='font-size:18px; font-weight:400; padding-right:10px;color:orange'></i>",
xss: false
});
warningDiv.title = "You did not consent to terms of the license of Google Maps Platform. Click the \"Edit\" button to do so.";
viewTd.appendChild(warningDiv)
} else {
viewTd.appendChild(checkbox);
}
} else {
var img = guiUtils.createIcon("icons/search.png");
var link = Functions.createElement({type: "a", href: "#", name: "overlayLink", data: overlay.getId()});
......
......@@ -203,6 +203,12 @@ AbstractDbOverlay.prototype.searchByEncodedQuery = function (originalQuery, fitB
return this.searchByTarget(new IdentifiedElement(query.target));
} else if (query.type === AbstractDbOverlay.QueryType.SEARCH_BY_COORDINATES) {
query.coordinates = new Point(query.coordinates.x, query.coordinates.y);
if (this.getMap().getSubmapById(query.modelId) === null) {
//this can happen when cached data comes from project that was removed and something else
//was uploaded with the same name
logger.warn("Invalid search query. Model doesn't exist: " + query.modelId);
return Promise.resolve();
}
return this.searchByCoordinates(query);
} else {
throw new Error("Unknown type of query: " + query.type);
......
......@@ -408,7 +408,7 @@ function create(params) {
return ServerConnector.getLoggedUser();
}).then(function (user) {
if (leftPanel.isGoogleLicenseConsentRequired()) {
GuiConnector.alert("Some data overlays doesn't have consent to the terms of the <a href='https://cloud.google.com/maps-platform/terms/' target='_blank'>license of Google Maps Platform</a>. To be able to visualize them you must edit data overlay. ")
GuiConnector.warn("Visualization of data overlays (Overlays tab) requires consent to terms of the <a href='https://cloud.google.com/maps-platform/terms/' target='_blank'>license of Google Maps Platform</a>. Click the \"Edit\" button for the overlay to do so.");
}
if (user.getLogin() !== "anonymous" && !user.isTermsOfUseConsent()) {
requestConsent(user, params.getConfiguration().getOption(ConfigurationType.TERMS_OF_USE).getValue());
......
-- empty file to force directory to be commited to git repo
......@@ -81,13 +81,17 @@ public class ChemicalRestImpl extends BaseRestImpl {
String description = "Mesh term not available";
List<String> synonyms = new ArrayList<>();
try {
MeSH mesh = meSHParser.getMeSH(chemical.getChemicalId());
description = mesh.getDescription();
synonyms = mesh.getSynonyms();
} catch (AnnotatorException e) {
logger.error("Problem with accessing mesh database", e);
}
try {
MeSH mesh = meSHParser.getMeSH(chemical.getChemicalId());
if (mesh != null) {
description = mesh.getDescription();
synonyms = mesh.getSynonyms();
} else {
logger.warn("Mesh used by chemical is invalid: " + chemical.getChemicalId());
}
} catch (AnnotatorException e) {
logger.error("Problem with accessing mesh database", e);
}
for (String string : columnsSet) {
String column = string.toLowerCase();
......
......@@ -21,13 +21,18 @@ import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.services.interfaces.IModelService;
import lcsb.mapviewer.services.search.db.DbSearchCriteria;
import lcsb.mapviewer.services.search.db.chemical.IChemicalService;
public class ChemicalRestImplTest extends RestTestFunctions {
Logger logger = Logger.getLogger(ChemicalRestImplTest.class);
@Autowired
@Autowired
private ChemicalRestImpl _drugRestImpl;
private ChemicalRestImpl _drugRestImpl;
@Autowired
private IChemicalService chemicalService;
@AfterClass
public static void tearDownAfterClass() throws Exception {
......@@ -41,18 +46,30 @@ public class ChemicalRestImplTest extends RestTestFunctions {
public void tearDown() throws Exception {
}
@Test
public void testPrepareChemical() throws Exception {
try {
Chemical chemical = new Chemical();
chemical.setChemicalId(new MiriamData(MiriamType.MESH_2012, "D010300"));
Map<String, Object> result = _drugRestImpl.prepareChemical(chemical, _drugRestImpl.createChemicalColumnSet(""), new ArrayList<>());
assertNotNull(result);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testPrepareChemical() throws Exception {
try {
Chemical chemical = new Chemical();
chemical.setChemicalId(new MiriamData(MiriamType.MESH_2012, "D010300"));
Map<String, Object> result = _drugRestImpl.prepareChemical(chemical, _drugRestImpl.createChemicalColumnSet(""), new ArrayList<>());
assertNotNull(result);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testPrepareChemicalWithProblematicMesh() throws Exception {
try {
Chemical chemical = chemicalService.getByName("Tetrachlorodibenzodioxin", new DbSearchCriteria().disease(new MiriamData(MiriamType.MESH_2012, "D010300")));
Map<String, Object> result = _drugRestImpl.prepareChemical(chemical, _drugRestImpl.createChemicalColumnSet(""), new ArrayList<>());
assertNotNull(result);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
protected ChemicalRestImpl createMockChemicalRest(String string) throws Exception {
Model model = super.getModelForFile(string, true);
......
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