diff --git a/CHANGELOG b/CHANGELOG index 85156b159c8346f9739e2cbe3807d119352daf1e..d7970ed615c3ba461daba42295b45c2c618d41c2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/frontend-js/src/main/js/GuiConnector.js b/frontend-js/src/main/js/GuiConnector.js index af8f68cdef0985d7f1782218192b70608a7761b4..c9f44579346a898451e82003e8d823a9bf3e0ba6 100644 --- a/frontend-js/src/main/js/GuiConnector.js +++ b/frontend-js/src/main/js/GuiConnector.js @@ -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; diff --git a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js index ad6006a376b58b4ed02ce95909ace8e77cbb471b..fd81dc33ffd165d20dec913a6d029f80b766000a 100644 --- a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js @@ -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()}); diff --git a/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js b/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js index 8c92adff938335911b0c4ac0c2a717bd0db2b639..85906d905631f2323f1f1d6e243da80ff87f7c49 100644 --- a/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js @@ -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); diff --git a/frontend-js/src/main/js/minerva.js b/frontend-js/src/main/js/minerva.js index c9fc776c29db4036bf132dc1a3293162eb346695..f14b4795e068c5221acb7deaeba2379a13e1165d 100644 --- a/frontend-js/src/main/js/minerva.js +++ b/frontend-js/src/main/js/minerva.js @@ -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()); diff --git a/persist/src/db/11.1.2/fix_db_20180704.sql b/persist/src/db/11.1.2/fix_db_20180704.sql new file mode 100644 index 0000000000000000000000000000000000000000..a33b6ad89d4881c84fb355b8c56d309760e66b70 --- /dev/null +++ b/persist/src/db/11.1.2/fix_db_20180704.sql @@ -0,0 +1 @@ +-- empty file to force directory to be commited to git repo diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java index a282a983db27dc5f58a2c1bf127923c8f6e5f6ba..babedeb740627fcdbc1d62139d7ead2aae5b28f6 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java @@ -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(); diff --git a/rest-api/src/test/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImplTest.java b/rest-api/src/test/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImplTest.java index 32b1acd9ede8099f67a72ad949d864f29c081051..ba530e1803d366a1989f6c10a25e80048655e5ff 100644 --- a/rest-api/src/test/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImplTest.java +++ b/rest-api/src/test/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImplTest.java @@ -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);