Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Devrim Gunyel
core
Commits
d7f142ab
Commit
d7f142ab
authored
Apr 05, 2019
by
Piotr Gawron
Browse files
exporting reactions allow to filter by submap
parent
b1fefbfd
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
d7f142ab
...
...
@@ -35,6 +35,8 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
type
(#
784
)
*
Small
improvement
:
when
plugin
listeners
crash
the
system
notifies
user
about
problem
with
a
plugin
(#
767
)
*
Small
improvement
:
when
exporting
list
of
reaction
there
is
possibility
to
filter
by
(
sub
)
map
(#
615
)
*
Bug
fix
:
progress
bar
of
gene
genome
mapping
upload
is
refreshing
properly
(#
728
)
*
Bug
fix
:
when
editing
project
Disease
and
Organism
could
not
be
removed
...
...
frontend-js/src/main/js/gui/export/AbstractExportPanel.js
View file @
d7f142ab
...
...
@@ -183,6 +183,71 @@ AbstractExportPanel.prototype._createSelectTypeDiv = function (elementTypes, pan
return
typeDiv
;
};
/**
*
* @param {MapModel[]} models
* @returns {HTMLElement}
* @protected
*/
AbstractExportPanel
.
prototype
.
_createSelectSubmapDiv
=
function
(
models
)
{
var
panelName
=
"
(sub)map:
"
;
var
mapDiv
=
Functions
.
createElement
({
type
:
"
div
"
,
name
:
"
mapSelectDiv
"
});
mapDiv
.
appendChild
(
Functions
.
createElement
({
type
:
"
h4
"
,
content
:
panelName
}));
var
choicesContainer
=
Functions
.
createElement
({
type
:
"
ul
"
,
className
:
"
minerva-checkbox-grid
"
});
mapDiv
.
appendChild
(
choicesContainer
);
var
sortedModels
=
models
.
slice
();
sortedModels
.
sort
(
function
(
a
,
b
)
{
if
(
a
.
getName
()
<
b
.
getName
())
{
return
-
1
;
}
if
(
a
.
getName
()
>
b
.
getName
())
{
return
1
;
}
return
0
;
});
for
(
var
i
=
0
;
i
<
sortedModels
.
length
;
i
++
)
{
var
model
=
sortedModels
[
i
];
var
name
=
model
.
getName
();
var
id
=
model
.
getId
();
var
row
=
Functions
.
createElement
({
type
:
"
li
"
,
content
:
"
<div class=
\"
checkbox
\"
><label> <input type=
\"
checkbox
\"
name=
\"
"
+
name
+
"
\"
value=
\"
"
+
id
+
"
\"
/>
"
+
name
+
"
</label></div>
"
,
xss
:
false
});
choicesContainer
.
appendChild
(
row
);
}
return
mapDiv
;
};
/**
*
* @param {HTMLElement} [htmlElement]
* @returns {number[]}
*/
AbstractExportPanel
.
prototype
.
getSelectedSubmapIds
=
function
(
htmlElement
)
{
var
self
=
this
;
if
(
htmlElement
===
undefined
)
{
htmlElement
=
self
.
getElement
();
}
var
div
=
$
(
"
div[name='mapSelectDiv']
"
,
$
(
htmlElement
))[
0
];
var
result
=
[];
$
(
"
:checked
"
,
$
(
div
)).
each
(
function
(
index
,
element
)
{
result
.
push
(
parseInt
(
$
(
element
).
val
()));
});
return
result
;
};
/**
*
* @param {HTMLElement} [htmlElement]
...
...
frontend-js/src/main/js/gui/export/NetworkExportPanel.js
View file @
d7f142ab
...
...
@@ -46,6 +46,10 @@ NetworkExportPanel.prototype.init = function () {
var
reactionTypeDiv
=
Functions
.
createElement
({
type
:
"
div
"
,
name
:
"
reactionTypes
"
});
reactionTypeDiv
.
appendChild
(
self
.
_createSelectTypeDiv
(
configuration
.
getReactionTypes
(),
"
Reaction type
"
));
element
.
appendChild
(
reactionTypeDiv
);
var
submapDiv
=
Functions
.
createElement
({
type
:
"
div
"
,
name
:
"
submapTypes
"
});
submapDiv
.
appendChild
(
self
.
_createSelectSubmapDiv
(
self
.
getProject
().
getModels
()));
element
.
appendChild
(
submapDiv
);
element
.
appendChild
(
self
.
_createSelectColumnDiv
(
self
.
getAllColumns
()));
return
self
.
getServerConnector
().
getProjectStatistics
(
self
.
getProject
().
getProjectId
()).
then
(
function
(
statistics
)
{
return
self
.
_createMiriamTypeDiv
(
statistics
.
getReactionAnnotations
());
...
...
@@ -135,12 +139,18 @@ NetworkExportPanel.prototype.getAllColumns = function () {
* @param {Reaction} reaction
* @param {Object<string,boolean>} elementIds
* @param {string[]} reactionTypes
* @param {number[]} submapIds
* @returns {boolean}
*/
function
matchReaction
(
reaction
,
elementIds
,
reactionTypes
)
{
function
matchReaction
(
reaction
,
elementIds
,
reactionTypes
,
submapIds
)
{
if
(
$
.
inArray
(
reaction
.
getType
(),
reactionTypes
)
===
-
1
)
{
return
false
;
}
if
(
submapIds
.
length
>
0
)
{
if
(
$
.
inArray
(
reaction
.
getModelId
(),
submapIds
)
===
-
1
)
{
return
false
;
}
}
var
count
=
0
;
reaction
.
getElements
().
forEach
(
function
(
element
)
{
if
(
elementIds
[
element
.
getId
()])
{
...
...
@@ -157,6 +167,7 @@ function matchReaction(reaction, elementIds, reactionTypes) {
NetworkExportPanel
.
prototype
.
createResponseString
=
function
()
{
var
self
=
this
;
var
elementTypes
,
reactionTypes
,
miriamTypes
;
var
submapIds
=
self
.
getSelectedSubmapIds
();
var
includedCompartmentIds
=
[];
var
excludedCompartmentIds
=
[];
var
models
=
self
.
getProject
().
getModels
();
...
...
@@ -210,7 +221,7 @@ NetworkExportPanel.prototype.createResponseString = function () {
for
(
var
i
=
0
;
i
<
models
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
reactionsByModel
[
i
].
length
;
j
++
)
{
var
reaction
=
reactionsByModel
[
i
][
j
];
if
(
matchReaction
(
reaction
,
elementIds
,
reactionTypes
))
{
if
(
matchReaction
(
reaction
,
elementIds
,
reactionTypes
,
submapIds
))
{
reactions
.
push
(
reaction
);
}
}
...
...
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