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

Merge branch '176-drugs-show-all-content-and-alignment' into 'master'

Resolve "Drugs - Show all - content and alignment"

Closes #176

See merge request !89
parents cc90804a 8728098b
No related branches found
No related tags found
1 merge request!89Resolve "Drugs - Show all - content and alignment"
......@@ -117,7 +117,7 @@ TopMenu.prototype._createGui = function() {
var refreshCommentButton = Functions.createElement({
type : "button",
className : "overview_button",
className : "minerva-overview-button",
name : "refreshCommentButton",
content : "<i class='fa fa-refresh' style='font-size:21px; font-weight:400;'></i>",
style : "display:none",
......@@ -127,7 +127,7 @@ TopMenu.prototype._createGui = function() {
var clearButton = Functions.createElement({
type : "button",
className : "overview_button",
className : "minerva-overview-button",
name : "clearButton",
content : "<i class='fa fa-times' style='font-size:18px; font-weight:300; padding-right:10px;'></i>CLEAR",
});
......
"use strict";
/* exported logger */
var logger = require('../logger');
var AbstractCustomMap = require('./AbstractCustomMap');
var CustomMapOptions = require('./CustomMapOptions');
......
......@@ -32,19 +32,17 @@ function AbstractInfoWindow(params) {
var onOverlayFullViewChanged = function(e) {
var self = e.object;
// first change the content of the element
return self.update().then(
function() {
if (e.newVal) {
var element = new IdentifiedElement({
objectId : self.getElementId(),
modelId : self.getCustomMap().getId(),
type : self.getElementType()
});
return self.getCustomMap().getTopMap().retrieveOverlayDetailDataForElement(element,
self.getOverlayFullViewArray());
}
return self.update().then(function() {
if (e.newVal) {
var element = new IdentifiedElement({
objectId : self.getElementId(),
modelId : self.getCustomMap().getId(),
type : self.getElementType()
});
var topMap = self.getCustomMap().getTopMap();
return topMap.retrieveOverlayDetailDataForElement(element, self.getOverlayFullViewArray());
}
});
};
......@@ -222,7 +220,11 @@ AbstractInfoWindow.prototype.createOverlayInfoDiv = function(overlay, data) {
* @returns {String} with a div for drug overlay information
*/
AbstractInfoWindow.prototype._createDrugInfoDiv = function(overlay, data) {
return this._createTargetInfoDiv(overlay, data, "Interacting drugs");
return this._createTargetInfoDiv({
overlay : overlay,
data : data,
name : "Interacting drugs"
});
};
/**
......@@ -408,7 +410,11 @@ AbstractInfoWindow.prototype.update = function() {
return this._updateContent();
};
AbstractInfoWindow.prototype._createTargetInfoDiv = function(overlay, data, name) {
AbstractInfoWindow.prototype._createTargetInfoDiv = function(params) {
var overlay = params.overlay;
var data = params.data;
var name = params.name;
var self = this;
var result = document.createElement("div");
......@@ -472,6 +478,11 @@ AbstractInfoWindow.prototype._createTableForTargetDiv = function(data, overlay)
table.appendChild(header);
var row;
var onclick = function() {
// ';' enforces single query (in case there are ',' characters in the name)
return overlay.searchByQuery(this.innerHTML + ";");
};
var count = 0;
for ( var searchId in data) {
if (data.hasOwnProperty(searchId)) {
......@@ -491,10 +502,18 @@ AbstractInfoWindow.prototype._createTableForTargetDiv = function(data, overlay)
}
}
}
row.appendChild(Functions.createElement({
var link = Functions.createElement({
type : "a",
onclick : onclick,
href : "#",
content : nameContent,
});
var nameTd = Functions.createElement({
type : "td",
content : nameContent
}));
});
nameTd.appendChild(link);
row.appendChild(nameTd);
var referencesCell = Functions.createElement({
type : "td",
......@@ -550,7 +569,11 @@ AbstractInfoWindow.prototype.getGuiUtils = function() {
* @returns DOM element with a div for comment overlay information
*/
AbstractInfoWindow.prototype._createChemicalInfoDiv = function(overlay, data) {
return this._createTargetInfoDiv(overlay, data, "Interacting chemicals");
return this._createTargetInfoDiv({
overlay : overlay,
data : data,
name : "Interacting chemicals",
});
};
/**
......@@ -561,7 +584,11 @@ AbstractInfoWindow.prototype._createChemicalInfoDiv = function(overlay, data) {
* @returns DOM element with a div for comment overlay information
*/
AbstractInfoWindow.prototype._createMiRnaInfoDiv = function(overlay, data) {
return this._createTargetInfoDiv(overlay, data, "Interacting Micro RNAs");
return this._createTargetInfoDiv({
overlay : overlay,
data : data,
name : "Interacting Micro RNAs"
});
};
/**
......
"use strict";
/* exported logger */
/* exported assert */
var Export = require('../../main/js/Export');
var logger = require('./logger');
......
......@@ -125,6 +125,32 @@ describe('AliasInfoWindow', function() {
});
});
it("createChemicalOverlayInfoDiv", function() {
var map, ie, aliasWindow, oc;
return ServerConnector.getProject().then(function(project) {
map = helper.createCustomMap(project);
oc = helper.createChemicalDbOverlay(map);
ie = new IdentifiedElement({
id : 329170,
modelId : map.getId(),
type : "ALIAS"
});
return map.getModel().getByIdentifiedElement(ie, true);
}).then(function(alias) {
aliasWindow = new AliasInfoWindow({
alias : alias,
map : map
});
return oc.getDetailDataByIdentifiedElement(ie, true);
}).then(function(data) {
var overlayDiv = aliasWindow.createOverlayInfoDiv(oc, data);
assert.ok(functions.isDomElement(overlayDiv));
});
});
it("createCommentOverlayInfoDiv", function() {
var map = helper.createCustomMap();
......
[{"elementId":"sa32","symbol":null,"formerSymbols":[],"other":{"structuralState":null,"modifications":[]},"notes":"","references":[{"resource":"622","link":"http://www.ncbi.nlm.nih.gov/gene/622","id":860352,"type":"ENTREZ"}],"modelId":15781,"synonyms":[],"fullName":null,"complexId":null,"type":"Protein","abbreviation":null,"compartmentId":null,"name":"BDH1","bounds":{"x":1225.7682370820667,"width":80.0,"y":66.0,"height":40.0},"formula":null,"id":329170,"linkedSubmodel":null,"hierarchyVisibilityLevel":"0"}]
\ No newline at end of file
......@@ -2,6 +2,7 @@ package lcsb.mapviewer.api;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -200,6 +201,23 @@ public abstract class BaseRestImpl {
for (Target target : targets) {
result.add(prepareTarget(target, models));
}
result.sort(new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
List<?> targetedObjects1 = (List<?>) o1.get("targetElements");
List<?> targetedObjects2 = (List<?>) o2.get("targetElements");
Integer size1 = 0;
Integer size2 = 0;
if (targetedObjects1 != null) {
size1 = targetedObjects1.size();
}
if (targetedObjects2 != null) {
size2 = targetedObjects2.size();
}
return -size1.compareTo(size2);
}
});
return result;
}
......@@ -238,5 +256,4 @@ public abstract class BaseRestImpl {
}
}
}
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