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

merge 16.2.1 into master

parent 4c4400ef
Pipeline #57780 passed with stage
in 26 minutes and 52 seconds
......@@ -28,8 +28,14 @@ minerva (17.0.0~alpha.0) unstable; urgency=medium
minerva (16.2.1) stable; urgency=medium
* Bug fix: Kegg annotator stopped working after kegg moved to https
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 1 Jun 2022 14:00:00 +0200
* Bug fix: General overlays were marked as editable even though they should
not be (#1706, #1702)
* Bug fix: searching for non existing chemical caused an error to be thrown
(#1704)
* Bug fix: there was an unexpected error when project did not contain any
map (#1705)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 13 Jun 2022 14:00:00 +0200
minerva (16.2.0) stable; urgency=medium
* Small improvement: cookie policy is supported (#1697, #1700)
......
......@@ -125,7 +125,7 @@ OverlayPanel.prototype.showLegend = function (overlayId) {
dialogClass: 'minerva-overlay-legend-dialog',
autoOpen: false,
resizable: false,
position: { my: "left bottom", at: "left bottom"},
position: {my: "left bottom", at: "left bottom"},
width: "350px"
});
$(div).dialog('option', 'title', 'Overlay legend');
......@@ -349,7 +349,7 @@ OverlayPanel.prototype.createOverlayRow = function (overlay, checked, disabled)
result.appendChild(dataTd);
if (overlay.getCreator() !== "" && overlay.getCreator() !== undefined) {
if (overlay.getCreator() !== "" && overlay.getCreator() !== undefined && !overlay.getPublicOverlay()) {
var editTd = document.createElement("td");
button = Functions.createElement({
type: "button",
......
......@@ -53,8 +53,11 @@ function processUrlGetParams(params) {
var modelId;
if (GuiConnector.getParams["submap"] !== undefined) {
modelId = parseInt(GuiConnector.getParams["submap"]);
} else {
} else if (project.getModels().length > 0) {
modelId = project.getModels()[0].getId()
} else {
return Promise.reject(new ValidationError("You cannot browse the project because it does not contain any map. " +
"Please re-upload the project."));
}
var model = project.getModelById(modelId);
......@@ -476,10 +479,10 @@ function create(params) {
}
return promise;
}).then(function () {
var element = params.getElement();
processUrlGetParams(params);
return processUrlGetParams(params);
}).then(function () {
var element = params.getElement();
params.getElement().innerHTML = "";
createDivStructure(element);
params.setElement(functions.getElementByClassName(element, "minerva-map"));
......
package lcsb.mapviewer.api.projects.chemicals;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -62,7 +61,7 @@ public class ChemicalController extends BaseController {
throw new QueryException("Project doesn't have disease associated to it");
}
List<Chemical> data;
List<Chemical> data = new ArrayList<>();
if (!query.equals("")) {
MiriamData organism = project.getOrganism();
......@@ -70,8 +69,11 @@ public class ChemicalController extends BaseController {
organism = TaxonomyBackend.HUMAN_TAXONOMY;
}
data = Arrays.asList(
chemicalService.getByName(query, new DbSearchCriteria().project(project).organisms(organism).colorSet(0).disease(project.getDisease())));
Chemical chemical = chemicalService.getByName(query,
new DbSearchCriteria().project(project).organisms(organism).colorSet(0).disease(project.getDisease()));
if (chemical != null) {
data.add(chemical);
}
} else if (target.contains(":")) {
String targetType = target.split(":", -1)[0];
String targetId = target.split(":", -1)[1];
......@@ -90,8 +92,6 @@ public class ChemicalController extends BaseController {
data = chemicalService.getForTargets(targets,
new DbSearchCriteria().project(project).organisms(organism).disease(project.getDisease()));
} else {
data = new ArrayList<>();
}
MappingJacksonValue result = new MappingJacksonValue(data);
......
package lcsb.mapviewer.web;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
......@@ -232,4 +233,19 @@ public class ChemicalControllerIntegrationTest extends ControllerIntegrationTest
.andExpect(status().isNotFound());
}
@Test
public void testSearchChemicalsWithUnknownChemical() throws Exception {
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/api/projects/{projectId}/chemicals:search?query=blablablablah&columns=name", TEST_PROJECT)
.session(session);
String content = mockMvc.perform(request)
.andExpect(status().is2xxSuccessful())
.andReturn().getResponse().getContentAsString();
List<Object> list = objectMapper.readValue(content, new TypeReference<Object>() {
});
assertEquals(0, list.size());
}
}
Supports Markdown
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