Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
082455c7
Commit
082455c7
authored
Apr 01, 2019
by
Piotr Gawron
Browse files
Merge branch 'devel_12.2.x'
parents
ff787235
e6d4b196
Pipeline
#9573
passed with stage
in 12 minutes and 30 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
082455c7
...
...
@@ -38,6 +38,21 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
* Bug fix: "Unknown Catalysis" and "Unknown Inhibition" reaction end is
slightly separated from target phenotype (#664)
minerva (12.2.1) stable; urgency=medium
* Bug fix: export of reaction colorsi in SBML is properly encoded (COPASI can
read colors properly) (#744)
* Bug fix: removing active plugin didn'
t
switch
plugin
tab
to
the
next
loaded
plugin
(#
757
)
*
Bug
fix
:
closed
submap
will
not
be
reopened
after
page
refresh
(#
763
)
*
Bug
fix
:
comment
remove
button
is
disabled
for
users
without
proper
privileges
(#
766
)
*
Bug
fix
:
invalid
pubmed
identifier
could
break
clicking
on
element
containing
it
(#
764
,
#
765
,
#
769
)
*
Bug
fix
:
cache
for
API
queries
is
explicitly
disabled
-
some
queries
could
be
mistakenly
cached
and
the
system
behaviour
might
get
unstable
(#
771
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
1
Apr
2019
17
:
00
:
00
+
0200
minerva
(
12.2.0
)
stable
;
urgency
=
medium
*
Feature
:
bug
report
utility
*
Feature
:
url
GET
parameters
support
all
kind
of
search
and
selected
overlays
...
...
converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/reaction/SbmlReactionExporter.java
View file @
082455c7
...
...
@@ -296,6 +296,7 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
renderInformation
.
addLocalStyle
(
style
);
ColorDefinition
color
=
getColorDefinition
(
node
.
getLine
().
getColor
());
style
.
getGroup
().
setStroke
(
color
.
getId
());
style
.
getGroup
().
setFill
(
color
.
getId
());
style
.
getGroup
().
setStrokeWidth
(
node
.
getLine
().
getWidth
());
style
.
getGroup
().
setStrokeDashArray
(
strokeToArray
(
node
.
getLine
().
getType
().
getStroke
()));
...
...
frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js
View file @
082455c7
...
...
@@ -4,6 +4,7 @@ var AbstractGuiElement = require('../AbstractGuiElement');
var
Functions
=
require
(
'
../../Functions
'
);
var
GuiConnector
=
require
(
'
../../GuiConnector
'
);
var
PrivilegeType
=
require
(
'
../../map/data/PrivilegeType
'
);
// noinspection JSUnusedLocalSymbols
var
logger
=
require
(
'
../../logger
'
);
...
...
@@ -16,7 +17,7 @@ var xss = require('xss');
* @param {Object} params
* @param {HTMLElement} params.element
* @param {Configuration} params.configuration
* @param {Project}
[
params.project
]
* @param {Project} params.project
* @param {ServerConnector} [params.serverConnector]
*
* @constructor
...
...
@@ -93,7 +94,7 @@ CommentsAdminPanel.prototype._createGui = function () {
*/
CommentsAdminPanel
.
prototype
.
init
=
function
()
{
var
self
=
this
;
return
self
.
refresh
Projec
ts
();
return
self
.
refresh
Commen
ts
();
};
/**
...
...
@@ -112,6 +113,12 @@ CommentsAdminPanel.prototype.refreshComments = function () {
data
.
push
(
self
.
commentToTableRow
(
comments
[
i
]));
}
dataTable
.
clear
().
rows
.
add
(
data
).
draw
();
return
self
.
getServerConnector
().
getLoggedUser
();
}).
then
(
function
(
user
)
{
var
type
=
self
.
getConfiguration
().
getPrivilegeType
(
PrivilegeType
.
EDIT_COMMENTS_PROJECT
);
if
(
!
user
.
hasPrivilege
(
type
,
self
.
getProject
().
getId
()))
{
$
(
"
[name='removeComment']
"
,
self
.
getElement
()).
attr
(
"
disabled
"
,
true
);
}
});
};
...
...
frontend-js/src/main/js/gui/admin/EditProjectDialog.js
View file @
082455c7
...
...
@@ -33,6 +33,7 @@ var xss = require('xss');
function
EditProjectDialog
(
params
)
{
AbstractGuiElement
.
call
(
this
,
params
);
var
self
=
this
;
guiUtils
.
setConfiguration
(
params
.
configuration
);
self
.
setConfiguration
(
params
.
configuration
);
self
.
registerListenerType
(
"
onSave
"
);
$
(
self
.
getElement
()).
addClass
(
"
minerva-edit-project-dialog
"
);
...
...
frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
View file @
082455c7
...
...
@@ -1177,6 +1177,13 @@ GuiUtils.prototype.removeTab = function (abstractGuiElement, panel) {
}
else
{
logger
.
warn
(
"
Cannot find tab for panel:
"
+
panel
);
}
var
isActive
=
$
(
"
.nav-tabs > li.active
"
,
$
(
abstractGuiElement
.
getElement
())).
length
>
0
;
if
(
!
isActive
)
{
var
links
=
$
(
"
.nav-tabs > li
"
,
$
(
abstractGuiElement
.
getElement
()));
if
(
links
.
length
>
0
)
{
$
(
"
a
"
,
$
(
links
[
0
])).
click
();
}
}
};
/**
...
...
frontend-js/src/main/js/map/CustomMap.js
View file @
082455c7
...
...
@@ -42,6 +42,7 @@ function CustomMap(options) {
this
.
registerListenerType
(
"
onHideOverlay
"
);
this
.
registerListenerType
(
"
onBackgroundOverlayChange
"
);
this
.
registerListenerType
(
"
onSubmapOpen
"
);
this
.
registerListenerType
(
"
onSubmapClose
"
);
// @type {boolean[]}
this
.
_selectedOverlays
=
[];
...
...
@@ -134,9 +135,14 @@ CustomMap.prototype.init = function () {
* Create submaps.
*/
CustomMap
.
prototype
.
createSubmaps
=
function
()
{
this
.
submaps
=
[];
for
(
var
i
=
1
;
i
<
this
.
getProject
().
getModels
().
length
;
i
++
)
{
this
.
submaps
.
push
(
new
Submap
(
this
,
this
.
getProject
().
getModels
()[
i
]));
var
self
=
this
;
self
.
submaps
=
[];
for
(
var
i
=
1
;
i
<
self
.
getProject
().
getModels
().
length
;
i
++
)
{
var
submap
=
new
Submap
(
self
,
self
.
getProject
().
getModels
()[
i
]);
submap
.
addListener
(
"
onClose
"
,
function
(
event
)
{
return
self
.
callListeners
(
"
onSubmapClose
"
,
{
mapId
:
event
.
object
.
getId
()});
});
self
.
submaps
.
push
(
submap
);
}
};
...
...
frontend-js/src/main/js/map/data/PrivilegeType.js
View file @
082455c7
...
...
@@ -37,6 +37,8 @@ PrivilegeType.PROJECT_MANAGEMENT = 'PROJECT_MANAGEMENT';
PrivilegeType
.
ADD_MAP
=
'
ADD_MAP
'
;
PrivilegeType
.
USER_MANAGEMENT
=
'
USER_MANAGEMENT
'
;
PrivilegeType
.
LAYOUT_MANAGEMENT
=
'
LAYOUT_MANAGEMENT
'
;
PrivilegeType
.
EDIT_COMMENTS_PROJECT
=
'
EDIT_COMMENTS_PROJECT
'
;
/**
*
...
...
frontend-js/src/main/js/minerva.js
View file @
082455c7
...
...
@@ -372,6 +372,9 @@ function addUrlChangeListenersToCustomMap(customMap) {
customMap
.
addListener
(
"
onSubmapOpen
"
,
function
(
event
)
{
GuiConnector
.
setUrlParam
(
"
submap
"
,
event
.
arg
.
mapId
.
toString
());
});
customMap
.
addListener
(
"
onSubmapClose
"
,
function
(
event
)
{
GuiConnector
.
setUrlParam
(
"
submap
"
,
undefined
);
});
var
onCenterChangedHandler
=
function
(
event
)
{
if
(
event
.
object
.
getId
()
!==
customMap
.
getId
())
{
GuiConnector
.
setUrlParam
(
"
submap
"
,
event
.
object
.
getId
().
toString
());
...
...
frontend-js/src/test/js/gui/admin/CommentsAdminPanel-test.js
View file @
082455c7
...
...
@@ -14,11 +14,13 @@ var assert = chai.assert;
describe
(
'
CommentsAdminPanel
'
,
function
()
{
function
createDialog
()
{
return
ServerConnector
.
get
Configuration
().
then
(
function
(
configuration
)
{
return
ServerConnector
.
get
Project
().
then
(
function
(
project
)
{
return
new
CommentsAdminPanel
({
element
:
testDiv
,
configuration
:
configuration
,
customMap
:
null
configuration
:
helper
.
getConfiguration
(),
customMap
:
null
,
project
:
project
,
serverConnector
:
ServerConnector
});
});
}
...
...
@@ -75,4 +77,29 @@ describe('CommentsAdminPanel', function () {
});
});
});
describe
(
'
remove comment
'
,
function
()
{
it
(
'
admin can remove
'
,
function
()
{
helper
.
loginAsAdmin
();
var
dialog
;
return
createDialog
().
then
(
function
(
result
)
{
dialog
=
result
;
return
dialog
.
init
();
}).
then
(
function
()
{
assert
.
ok
(
$
(
"
[name='removeComment']
"
).
is
(
'
:enabled
'
));
return
dialog
.
destroy
();
});
});
it
(
'
anonymous cannot remove
'
,
function
()
{
var
dialog
;
return
createDialog
().
then
(
function
(
result
)
{
dialog
=
result
;
return
dialog
.
init
();
}).
then
(
function
()
{
assert
.
ok
(
$
(
"
[name='removeComment']
"
).
is
(
'
:disabled
'
));
return
dialog
.
destroy
();
});
});
});
});
frontend-js/src/test/js/minerva-test.js
View file @
082455c7
...
...
@@ -6,6 +6,7 @@ var Promise = require("bluebird");
var
minerva
=
require
(
'
../../main/js/minerva
'
);
var
ConfigurationType
=
require
(
'
../../main/js/ConfigurationType
'
);
var
GuiConnector
=
require
(
'
../../main/js/GuiConnector
'
);
var
SecurityError
=
require
(
'
../../main/js/SecurityError
'
);
var
ServerConnectorMock
=
require
(
'
./ServerConnector-mock
'
);
var
Point
=
require
(
'
../../main/js/map/canvas/Point
'
);
...
...
@@ -340,7 +341,7 @@ describe('minerva global', function () {
it
(
'
plugin onFocus functionality
'
,
function
()
{
helper
.
setUrl
(
"
http://test/?search=s1
"
);
var
globalObject
,
plugin
,
callbackCalled
=
false
;
var
globalObject
,
plugin
,
callbackCalled
=
false
;
return
ServerConnectorMock
.
getProject
().
then
(
function
(
project
)
{
var
options
=
helper
.
createCustomMapOptions
(
project
);
plugin
=
new
ProxyAccessPlugin
();
...
...
@@ -361,4 +362,29 @@ describe('minerva global', function () {
});
describe
(
"
close submap
"
,
function
()
{
it
(
"
check if url parameters changed
"
,
function
()
{
var
data
;
var
map
;
var
submapId
=
16729
;
var
submapParameter
;
var
projectId
=
"
complex_model_with_submaps
"
;
return
ServerConnectorMock
.
getProject
(
projectId
).
then
(
function
(
project
)
{
var
options
=
helper
.
createCustomMapOptions
(
project
);
options
.
setDebug
(
true
);
return
minerva
.
create
(
options
);
}).
then
(
function
(
result
)
{
data
=
result
;
map
=
result
.
customMap
;
return
map
.
openSubmap
(
submapId
);
}).
then
(
function
()
{
submapParameter
=
GuiConnector
.
getParams
[
"
submap
"
];
return
map
.
getSubmapById
(
submapId
).
close
();
}).
then
(
function
()
{
assert
.
notEqual
(
GuiConnector
.
getParams
[
"
submap
"
],
submapParameter
,
"
Submap parameter should change after submap was closed
"
);
return
data
.
destroy
();
})
});
});
});
rest-api/src/main/java/lcsb/mapviewer/api/BaseRestImpl.java
View file @
082455c7
...
...
@@ -19,6 +19,7 @@ import javax.xml.transform.TransformerFactoryConfigurationError;
import
javax.xml.transform.stream.StreamResult
;
import
javax.xml.transform.stream.StreamSource
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.ClassPathResource
;
...
...
@@ -121,11 +122,15 @@ public abstract class BaseRestImpl {
}
}
if
(
MiriamType
.
PUBMED
.
equals
(
annotation
.
getDataType
()))
{
try
{
Article
article
=
pubmedParser
.
getPubmedArticleById
(
annotation
.
getResource
());
result
.
put
(
"article"
,
article
);
}
catch
(
PubmedSearchException
e
)
{
logger
.
error
(
"Problem with accessing info about pubmed"
,
e
);
if
(
NumberUtils
.
isDigits
(
annotation
.
getResource
()))
{
try
{
Article
article
=
pubmedParser
.
getPubmedArticleById
(
annotation
.
getResource
());
result
.
put
(
"article"
,
article
);
}
catch
(
PubmedSearchException
e
)
{
logger
.
error
(
"Problem with accessing info about pubmed"
,
e
);
}
}
else
{
logger
.
error
(
"Invalid pubmed identifier: "
+
annotation
.
getResource
());
}
}
result
.
put
(
"type"
,
annotation
.
getDataType
().
name
());
...
...
rest-api/src/test/java/lcsb/mapviewer/api/BaseRestImplTest.java
View file @
082455c7
...
...
@@ -84,4 +84,21 @@ public class BaseRestImplTest extends RestTestFunctions {
}
}
@Test
public
void
testCreateAnnotationWithNonNumericValues
()
throws
Exception
{
BaseRestImpl
controller
=
Mockito
.
mock
(
BaseRestImpl
.
class
,
CALLS_REAL_METHODS
);
controller
.
setMiriamConnector
(
mc
);
controller
.
setPubmedParser
(
pubmedParser
);
Map
<
String
,
Object
>
response
=
controller
.
createAnnotation
(
new
MiriamData
(
MiriamType
.
PUBMED
,
"28255955PG"
));
assertNotNull
(
response
);
}
@Test
public
void
testCreateAnnotationWithEmptyValue
()
throws
Exception
{
BaseRestImpl
controller
=
Mockito
.
mock
(
BaseRestImpl
.
class
,
CALLS_REAL_METHODS
);
controller
.
setMiriamConnector
(
mc
);
controller
.
setPubmedParser
(
pubmedParser
);
Map
<
String
,
Object
>
response
=
controller
.
createAnnotation
(
new
MiriamData
(
MiriamType
.
PUBMED
,
""
));
assertNotNull
(
response
);
}
}
web/src/main/java/lcsb/mapviewer/web/bean/utils/ApiAccessControlFilter.java
View file @
082455c7
...
...
@@ -13,7 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import
org.apache.log4j.Logger
;
/**
* This filter
en
ables
x-frames from another domain if necessary
.
* This filter
dis
ables
caching for API queries
.
*
* @author Piotr Gawron
*
...
...
@@ -33,7 +33,12 @@ public class ApiAccessControlFilter implements Filter {
public
void
doFilter
(
ServletRequest
req
,
ServletResponse
res
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
HttpServletResponse
response
=
(
HttpServletResponse
)
res
;
//caching on Safari
response
.
addHeader
(
"Vary"
,
"*"
);
// generic cache prevent mechanism
response
.
addHeader
(
"Cache-Control"
,
"no-cache, no-store, must-revalidate"
);
response
.
addHeader
(
"Pragma"
,
"no-cache"
);
response
.
addHeader
(
"Expires"
,
"0"
);
chain
.
doFilter
(
req
,
response
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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