Skip to content
Snippets Groups Projects
Commit 6de5be39 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '110-crash-when-showing-window-with-empty-layout-data' into 'master'

Resolve "When showing window for overlay that doesn't have data there is an error"

Closes #110

See merge request !18
parents 3b2791a1 44eeb355
No related branches found
No related tags found
1 merge request!18Resolve "When showing window for overlay that doesn't have data there is an error"
......@@ -301,7 +301,7 @@ ServerConnector.getReferenceGenomeUrl = function(queryParams, filterParams) {
var version = this.getIdOrAsterisk(queryParams.version);
return this.getApiUrl({
type : "genomics/taxonomies/" + queryParams.organism + "/types/" + queryParams.type + "/versions/" + version,
type : "genomics/taxonomies/" + queryParams.organism + "/genomeTypes/" + queryParams.type + "/versions/" + version + "/",
params : filterParams
});
};
......
......@@ -270,7 +270,7 @@ AliasInfoWindow.prototype.createGenomicDiv = function() {
return Promise.each(
self.layoutAliases,
function(data) {
if (data !== null && data.getType() === LayoutAlias.GENETIC_VARIANT) {
if (data !== null && data !== undefined && data.getType() === LayoutAlias.GENETIC_VARIANT) {
geneticInformation = true;
return Promise.each(data.getGeneVariants(), function(variant) {
return self.getCustomMap().getReferenceGenome(variant.getReferenceGenomeType(),
......@@ -318,7 +318,7 @@ AliasInfoWindow.prototype.createGenomicDiv = function() {
}
return Promise.each(self.layoutAliases, function(data, i) {
globalGeneVariants[i] = [];
if (data !== null && data.getType() === LayoutAlias.GENETIC_VARIANT) {
if (data !== null && data !== undefined && data.getType() === LayoutAlias.GENETIC_VARIANT) {
var geneVariants = data.getGeneVariants();
for (var j = 0; j < geneVariants.length; j++) {
var variant = geneVariants[j];
......
......@@ -164,6 +164,32 @@ describe('AliasInfoWindow', function() {
});
it("createGeneticsDiv with no genetic data", function() {
var map;
var win;
var aliasId = 329173;
return ServerConnector.getProject().then(function(project) {
map = helper.createCustomMap(project);
var overlay = new LayoutData(18077, "xxx");
return overlay.init();
}).then(function() {
return map.getModel().getAliasById(aliasId);
}).then(function(alias) {
win = new AliasInfoWindow(alias, map);
return win.init();
}).then(function() {
win.layoutAliases = [ undefined ];
return win.createGenomicDiv();
}).then(function(div) {
assert.ok(div);
assert.ok(div.innerHTML.indexOf("No reference genome data available on minerva platform") === -1);
win.destroy();
});
});
it("createGeneticsDivForUnknownOrganism", function() {
var map;
var overlay;
......
......@@ -21,7 +21,7 @@ public class ReferenceGenomeController extends BaseController {
@Autowired
private ReferenceGenomeRestImpl referenceGenomeController;
@RequestMapping(value = "/genomics/taxonomies/{organismId}/genomeTypes/{type}/versions/{version}/", method = { RequestMethod.GET, RequestMethod.POST },
@RequestMapping(value = "/genomics/taxonomies/{organismId}/genomeTypes/{type}/versions/{version}/", method = { RequestMethod.GET },
produces = { MediaType.APPLICATION_JSON_VALUE })
public ReferenceGenomeView getDrugsByQuery(//
@CookieValue(value = Configuration.AUTH_TOKEN) String token, //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment