Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Devrim Gunyel
core
Commits
3461589e
Commit
3461589e
authored
Apr 10, 2019
by
Piotr Gawron
Browse files
list of element types is sorted
parent
4bd09968
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
3461589e
...
...
@@ -8,6 +8,8 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
*
Small
improvement
:
New
comment
dialog
does
not
contain
content
of
previous
comment
dialog
(#
680
)
*
Small
improvement
:
Left
logo
is
configurable
(#
731
)
*
Small
improvement
:
list
of
element
types
in
choose
annotator
dialog
is
sorted
(#
758
)
*
Small
improvement
:
Plugin
API
provides
list
of
overview
images
(#
702
)
*
Small
improvement
:
Plugin
API
allows
to
show
/
hide
overview
images
(#
702
)
*
Small
improvement
:
Plugin
API
allows
to
trigger
search
on
the
map
(#
702
)
...
...
frontend-js/src/main/js/gui/admin/ChooseAnnotatorsDialog.js
View file @
3461589e
...
...
@@ -7,7 +7,6 @@ var Annotator = require("../../map/data/Annotator");
var
AnnotatorParameter
=
require
(
"
../../map/data/AnnotatorParameter
"
);
var
GuiConnector
=
require
(
"
../../GuiConnector
"
);
var
MultiCheckboxList
=
require
(
"
multi-checkbox-list
"
);
var
UserPreferences
=
require
(
"
../../map/data/UserPreferences
"
);
var
Functions
=
require
(
'
../../Functions
'
);
var
Promise
=
require
(
'
bluebird
'
);
...
...
@@ -402,6 +401,33 @@ ChooseAnnotatorsDialog.prototype.createAnnotatorsParams = function (selectedAnno
};
/**
*
* @return {BioEntityTypeTreeNode[]}
*/
ChooseAnnotatorsDialog
.
prototype
.
getTypeNodeList
=
function
()
{
var
types
=
[];
var
treeData
=
this
.
getConfiguration
().
getElementTypeTree
();
var
queue
=
[
treeData
];
while
(
queue
.
length
>
0
)
{
var
node
=
queue
.
shift
();
if
(
node
.
children
!==
undefined
&&
node
.
children
.
length
>
0
)
{
for
(
var
i
=
0
;
i
<
node
.
children
.
length
;
i
++
)
{
queue
.
push
(
node
.
children
[
i
]);
}
}
else
{
types
.
push
(
node
);
}
}
types
.
sort
(
function
(
a
,
b
)
{
return
a
.
text
.
localeCompare
(
b
.
text
);
});
return
types
;
};
/**
*
* @returns {Promise}
...
...
@@ -412,22 +438,7 @@ ChooseAnnotatorsDialog.prototype.init = function () {
var
configuration
=
self
.
getConfiguration
();
var
treeData
=
configuration
.
getElementTypeTree
();
var
types
=
[];
var
queue
=
[
treeData
];
var
i
;
while
(
queue
.
length
>
0
)
{
var
node
=
queue
.
shift
();
if
(
node
.
children
!==
undefined
&&
node
.
children
.
length
>
0
)
{
for
(
i
=
0
;
i
<
node
.
children
.
length
;
i
++
)
{
queue
.
push
(
node
.
children
[
i
]);
}
}
else
{
types
.
push
(
node
);
}
}
var
types
=
self
.
getTypeNodeList
();
var
element
=
$
(
'
[name="elementList"]
'
,
self
.
getElement
())[
0
];
var
select
=
Functions
.
createElement
({
...
...
@@ -445,7 +456,7 @@ ChooseAnnotatorsDialog.prototype.init = function () {
}
});
select
.
size
=
15
;
for
(
i
=
0
;
i
<
types
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
types
.
length
;
i
++
)
{
var
type
=
types
[
i
];
var
option
=
Functions
.
createElement
({
type
:
"
option
"
,
...
...
@@ -482,9 +493,6 @@ ChooseAnnotatorsDialog.prototype.init = function () {
annotator
=
annotators
[
i
];
}
}
if
(
annotatorClassName
===
undefined
)
{
throw
new
Error
(
"
Annotator is not used by user:
"
+
div
.
innerHTML
);
}
return
self
.
createAnnotatorsParams
(
annotator
);
}).
catch
(
GuiConnector
.
alert
);
});
...
...
frontend-js/src/test/js/gui/admin/ChooseAnnotatorsDialog-test.js
View file @
3461589e
...
...
@@ -29,6 +29,15 @@ describe('ChooseAnnotatorsDialog', function () {
return
dialog
.
init
();
});
it
(
'
getTypeNodeList sorted
'
,
function
()
{
var
dialog
=
createDialog
();
var
types
=
dialog
.
getTypeNodeList
();
for
(
var
i
=
1
;
i
<
types
.
length
;
i
++
)
{
assert
.
ok
(
types
[
i
-
1
].
text
.
localeCompare
(
types
[
i
].
text
)
<=
0
,
types
[
i
-
1
].
text
+
"
and
"
+
types
[
i
].
text
+
"
are not sorted alphabetically
"
);
}
});
it
(
'
setElementType
'
,
function
()
{
var
dialog
=
createDialog
();
var
configuration
=
helper
.
getConfiguration
();
...
...
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