You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/10/16 15:39:18 UTC

atlas git commit: ATLAS-2212: UI fix to allow negative number input for tag attributes

Repository: atlas
Updated Branches:
  refs/heads/master 8663eb1de -> 32fa4be52


ATLAS-2212: UI fix to allow negative number input for tag attributes

Signed-off-by: Madhan Neethiraj <ma...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/32fa4be5
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/32fa4be5
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/32fa4be5

Branch: refs/heads/master
Commit: 32fa4be52b0459209525ab4e7ecc8469f44fb07f
Parents: 8663eb1
Author: pratik pandey <pr...@freestoneinfotech.com>
Authored: Mon Oct 16 18:49:43 2017 +0530
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Mon Oct 16 08:38:32 2017 -0700

----------------------------------------------------------------------
 dashboardv2/public/js/utils/Overrides.js           | 11 +++++++++++
 dashboardv2/public/js/views/tag/addTagModalView.js |  6 ++----
 2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/32fa4be5/dashboardv2/public/js/utils/Overrides.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/Overrides.js b/dashboardv2/public/js/utils/Overrides.js
index 4ffda57..dd36859 100644
--- a/dashboardv2/public/js/utils/Overrides.js
+++ b/dashboardv2/public/js/utils/Overrides.js
@@ -87,6 +87,17 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
             return false;
         }
     });
+    $('body').on('keypress', 'input.number-input-negative,.number-input-negative .select2-search__field', function(e) {
+        if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
+            if (e.which == 45) {
+                if (this.value.length) {
+                    return false;
+                }
+            } else {
+                return false;
+            }
+        }
+    });
 
     // For placeholder support 
     if (!('placeholder' in HTMLInputElement.prototype)) {

http://git-wip-us.apache.org/repos/asf/atlas/blob/32fa4be5/dashboardv2/public/js/views/tag/addTagModalView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js
index 423a92e..a169867 100644
--- a/dashboardv2/public/js/views/tag/addTagModalView.js
+++ b/dashboardv2/public/js/views/tag/addTagModalView.js
@@ -312,16 +312,14 @@ define(['require',
         },
         getElement: function(labelName, typeName) {
             var value = this.tagModel && this.tagModel.attributes ? (this.tagModel.attributes[labelName] || "") : "",
-                type = (typeName === "int" || typeName === "long" || typeName === "float" || typeName === "byte" || typeName === "double" || typeName === "short") ? "number" : "text";
+                className = ((typeName === "int" || typeName === "long" || typeName === "float" || typeName === "byte" || typeName === "double" || typeName === "short") ? "number-input-negative" : "") + " form-control attributeInputVal attrName";
             if (typeName === "boolean") {
                 return '<select class="form-control attributeInputVal attrName" data-key="' + labelName + '" data-type="' + typeName + '"> ' +
                     '<option value="">--Select true or false--</option>' +
                     '<option value="true">true</option>' +
                     '<option value="false">false</option></select>';
-            } else if (typeName === "int") {
-                return '<input type="' + type + '" value="' + value + '" class="form-control attributeInputVal attrName number-input" data-key="' + labelName + '"  data-type="' + typeName + '"></input></div>';
             } else {
-                return '<input type="' + type + '" value="' + value + '" class="form-control attributeInputVal attrName" data-key="' + labelName + '"  data-type="' + typeName + '"></input></div>';
+                return '<input type="text" value="' + value + '" class="' + className + '" data-key="' + labelName + '"  data-type="' + typeName + '"></input></div>';
             }
         },
         saveTagData: function(options) {