Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
880f878b
Commit
880f878b
authored
Jan 20, 2017
by
Piotr Gawron
Browse files
chemical panel disabled when disease is not defined for panel
parent
99ea49b2
Changes
6
Hide whitespace changes
Inline
Side-by-side
frontend-js/src/main/js/gui/AbstractPanel.js
View file @
880f878b
...
...
@@ -56,6 +56,21 @@ function AbstractPanel(params) {
AbstractPanel
.
prototype
=
Object
.
create
(
ObjectWithListeners
.
prototype
);
AbstractPanel
.
prototype
.
constructor
=
AbstractPanel
;
AbstractPanel
.
prototype
.
disablePanel
=
function
(
message
){
this
.
getSearchQueryElement
().
style
.
visibility
=
"
hidden
"
;
this
.
getSearchResultsElement
().
style
.
visibility
=
"
hidden
"
;
var
hideReasonDiv
=
document
.
createElement
(
"
div
"
);
hideReasonDiv
.
className
=
"
searchPanel
"
;
var
center
=
document
.
createElement
(
"
center
"
);
var
messageDiv
=
document
.
createElement
(
"
h4
"
);
messageDiv
.
innerHTML
=
message
;
center
.
appendChild
(
messageDiv
);
hideReasonDiv
.
appendChild
(
center
);
this
.
getElement
().
insertBefore
(
hideReasonDiv
,
this
.
getSearchQueryElement
());
};
AbstractPanel
.
prototype
.
setOverlayDb
=
function
(
overlayDb
){
if
(
overlayDb
===
undefined
)
{
throw
new
Error
(
"
Undefined overlayDb
"
);
...
...
frontend-js/src/main/js/gui/ChemicalPanel.js
View file @
880f878b
...
...
@@ -8,6 +8,10 @@ var AbstractPanel = require('./AbstractPanel');
function
ChemicalPanel
(
params
)
{
params
.
panelName
=
"
chemical
"
;
AbstractPanel
.
call
(
this
,
params
);
if
(
params
.
disease
===
undefined
)
{
this
.
disablePanel
(
"
DISEASE NOT DEFINED FOR PROJECT. PLEASE, DEFINE IT IN THE ADMIN SECTION.
"
);
}
}
ChemicalPanel
.
prototype
=
Object
.
create
(
AbstractPanel
.
prototype
);
ChemicalPanel
.
prototype
.
constructor
=
ChemicalPanel
;
...
...
frontend-js/src/main/js/map/data/Project.js
View file @
880f878b
...
...
@@ -31,6 +31,8 @@ Project.prototype.loadFromData = function(data) {
this
.
setDescription
(
data
.
description
);
this
.
setOverviewImages
(
data
.
overviewImageViews
);
this
.
setTopOverviewImage
(
data
.
topOverviewImage
);
this
.
setDisease
(
data
.
disease
);
this
.
setOrganism
(
data
.
organism
);
this
.
setModel
(
new
Model
(
data
.
map
));
...
...
@@ -94,4 +96,18 @@ Project.prototype.setDescription = function(description) {
this
.
_description
=
description
;
};
Project
.
prototype
.
getDisease
=
function
()
{
return
this
.
_disease
;
};
Project
.
prototype
.
setDisease
=
function
(
disease
)
{
this
.
_disease
=
disease
;
};
Project
.
prototype
.
getOrganism
=
function
()
{
return
this
.
_organism
;
};
Project
.
prototype
.
setOrganism
=
function
(
organism
)
{
this
.
_organism
=
organism
;
};
module
.
exports
=
Project
;
frontend-js/src/main/js/minerva.js
View file @
880f878b
...
...
@@ -66,6 +66,11 @@ function restoreDrugQuery(customMap) {
};
function
create
(
params
)
{
var
project
=
params
.
project
;
if
(
project
===
undefined
)
{
project
=
params
.
getProject
();
}
if
(
global
.
GuiConnector
===
undefined
)
{
global
.
GuiConnector
=
OriginalGuiConnector
;
global
.
ServerConnector
=
OriginalServerConnector
;
...
...
@@ -126,6 +131,7 @@ function create(params) {
collection
=
new
ChemicalDbOverlay
(
collectionParams
);
result
.
registerSource
(
collection
);
new
ChemicalPanel
({
disease
:
project
.
getDisease
(),
element
:
document
.
getElementById
(
"
chemicalTab
"
),
customMap
:
result
});
...
...
rest-api/src/main/java/lcsb/mapviewer/api/project/ProjectMetaData.java
View file @
880f878b
...
...
@@ -12,6 +12,7 @@ import lcsb.mapviewer.model.map.OverviewImage;
import
lcsb.mapviewer.model.map.OverviewImageLink
;
import
lcsb.mapviewer.model.map.OverviewLink
;
import
lcsb.mapviewer.model.map.model.ModelData
;
import
lcsb.mapviewer.services.view.AnnotationView
;
import
lcsb.mapviewer.services.view.OverviewImageView
;
import
lcsb.mapviewer.services.view.OverviewImageViewFactory
;
...
...
@@ -28,8 +29,12 @@ public class ProjectMetaData implements Serializable {
* Version of the project.
*/
private
String
version
;
private
Integer
idObject
;
private
AnnotationView
disease
;
private
AnnotationView
organism
;
private
Integer
idObject
;
/**
* Name of the project.
...
...
@@ -96,6 +101,7 @@ public class ProjectMetaData implements Serializable {
this
.
setTopOverviewImage
(
factory
.
create
(
model
.
getOverviewImages
().
get
(
0
)));
}
this
.
setMap
(
new
ModelMetaData
(
model
));
}
}
...
...
@@ -227,11 +233,46 @@ public class ProjectMetaData implements Serializable {
}
/**
* @param idObject the idObject to set
* @param idObject
* the idObject to set
* @see #idObject
*/
public
void
setIdObject
(
Integer
idObject
)
{
this
.
idObject
=
idObject
;
}
/**
* @return the disease
* @see #disease
*/
public
AnnotationView
getDisease
()
{
return
disease
;
}
/**
* @param disease
* the disease to set
* @see #disease
*/
public
void
setDisease
(
AnnotationView
disease
)
{
this
.
disease
=
disease
;
}
/**
* @return the organism
* @see #organism
*/
public
AnnotationView
getOrganism
()
{
return
organism
;
}
/**
* @param organism
* the organism to set
* @see #organism
*/
public
void
setOrganism
(
AnnotationView
organism
)
{
this
.
organism
=
organism
;
}
}
rest-api/src/main/java/lcsb/mapviewer/api/project/ProjectRestImpl.java
View file @
880f878b
...
...
@@ -57,6 +57,12 @@ public class ProjectRestImpl {
Project
project
=
projectService
.
getProjectByProjectId
(
projectId
,
userService
.
getToken
(
token
));
ProjectMetaData
result
=
new
ProjectMetaData
(
project
);
if
(
project
.
getOrganism
()
!=
null
)
{
result
.
setOrganism
(
annotationViewFactory
.
create
(
project
.
getOrganism
()));
}
if
(
project
.
getDisease
()
!=
null
)
{
result
.
setDisease
(
annotationViewFactory
.
create
(
project
.
getDisease
()));
}
return
result
;
}
...
...
@@ -328,7 +334,8 @@ public class ProjectRestImpl {
this
.
searchService
=
searchService
;
}
public
List
<
Map
<
String
,
Object
>>
getElementsByQuery
(
String
projectId
,
String
token
,
String
query
,
Integer
maxElements
,
String
perfectMatch
)
throws
SecurityException
{
public
List
<
Map
<
String
,
Object
>>
getElementsByQuery
(
String
projectId
,
String
token
,
String
query
,
Integer
maxElements
,
String
perfectMatch
)
throws
SecurityException
{
List
<
Map
<
String
,
Object
>>
resultMap
=
new
ArrayList
<>();
Model
model
=
modelService
.
getLastModelByProjectId
(
projectId
,
userService
.
getToken
(
token
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment