From 195709ec1091e489a76bd163616477f4e1d83118 Mon Sep 17 00:00:00 2001
From: David Hoksza <david.hoksza@uni.lu>
Date: Wed, 7 Feb 2018 16:02:56 +0100
Subject: [PATCH] sorting of annotations within annotator group in left panel

---
 .../src/main/js/gui/admin/ChooseAnnotatorsDialog.js       | 6 +-----
 frontend-js/src/main/js/gui/leftPanel/GuiUtils.js         | 8 ++++++++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/frontend-js/src/main/js/gui/admin/ChooseAnnotatorsDialog.js b/frontend-js/src/main/js/gui/admin/ChooseAnnotatorsDialog.js
index 782de66346..77a57eb5e4 100644
--- a/frontend-js/src/main/js/gui/admin/ChooseAnnotatorsDialog.js
+++ b/frontend-js/src/main/js/gui/admin/ChooseAnnotatorsDialog.js
@@ -106,8 +106,7 @@ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) {
           
           var paramsDefs = annotator.getParametersDefinitions();
           if (paramsDefs.length > 0) {
-            console.log('annotator', annotator);
-
+            
             annotatorsParams.appendChild(Functions.createElement({
               type: "div",    
               className: "minerva-annotators-params-header",
@@ -139,7 +138,6 @@ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) {
                 content: param.name
               });
 
-              console.log('param', param);
               var toolTip = Functions.createElement({
                 type: "span",
                 className: "annotator-tooltip",
@@ -156,8 +154,6 @@ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) {
                 existingParamValue = existingAnnotatorsParameters[annotator.getClassName()][param.name]
               }
 
-              console.log('existingParamValue', existingParamValue);
-
               if (param.type.indexOf("String") >= 0) {
                 paramValue = Functions.createElement({
                   type: "textarea",
diff --git a/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js b/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
index 99dae01f55..ebe9d8727f 100644
--- a/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
+++ b/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
@@ -209,6 +209,14 @@ GuiUtils.prototype.createAnnotationList = function (annotations, options) {
       groupContainer.appendChild(par);
     }
 
+    grouppedAnnotations[desc] = grouppedAnnotations[desc].sort(function(a, b) {
+      const aType = a.getType().toUpperCase();
+      const bType = b.getType().toUpperCase();
+      if (aType < bType) return -1;
+      else if (aType > bType) return 1;
+      else return 0;
+    });
+
     for (var j = 0; j < grouppedAnnotations[desc].length; j++) {
 
       cntAnnotations += 1;
-- 
GitLab