You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2020/02/29 03:52:43 UTC

[atlas] 02/02: ATLAS-3636 : [Namespace-UI] Issues/ambiguous error messages while adding a new attribute in a Namespace

This is an automated email from the ASF dual-hosted git repository.

kbhatt pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit bf1c8285b4fae1e1e436740165912bf5b0dab2eb
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Fri Feb 28 22:39:56 2020 +0530

    ATLAS-3636 : [Namespace-UI] Issues/ambiguous error messages while adding a new attribute in a Namespace
    
    (cherry picked from commit 69d403e8ca6b22648457e1df51b7e549b6882f3e)
---
 dashboardv3/public/css/scss/common.scss            |   8 +-
 dashboardv3/public/css/scss/namespace.scss         |   2 +-
 .../entity/EntityNameSpaceItemView_tmpl.html       |  34 +-
 .../templates/entity/EntityNameSpaceView_tmpl.html |   6 +-
 .../NameSpaceAttributeItemView_tmpl.html           |   2 +-
 .../js/views/entity/EntityNameSpaceItemView.js     |  47 +--
 .../public/js/views/entity/EntityNameSpaceView.js  |   9 +-
 .../views/name_space/CreateNameSpaceLayoutView.js  | 439 ++++++++++-----------
 .../views/name_space/EnumCreateUpdateItemView.js   |  11 +-
 .../views/name_space/NameSpaceAttributeItemView.js |   7 +
 .../views/name_space/NameSpaceTableLayoutView.js   |  10 +-
 11 files changed, 295 insertions(+), 280 deletions(-)

diff --git a/dashboardv3/public/css/scss/common.scss b/dashboardv3/public/css/scss/common.scss
index 016c8bf..a30057c 100644
--- a/dashboardv3/public/css/scss/common.scss
+++ b/dashboardv3/public/css/scss/common.scss
@@ -228,7 +228,6 @@ pre {
         .custom-col-1,
         .custom-col-2 {
             vertical-align: top;
-            display: inline-block;
 
             textarea {
                 resize: vertical;
@@ -254,8 +253,13 @@ pre {
         .custom-col-2 {
             text-align: center;
             width: 17%;
-            margin-left: 1%;
+            padding-left: 1%;
             margin-bottom: 10px;
+
+            &>button {
+                padding: 7px 10px;
+                margin-bottom: 10px;
+            }
         }
     }
 }
diff --git a/dashboardv3/public/css/scss/namespace.scss b/dashboardv3/public/css/scss/namespace.scss
index b5952ae..4b5125c 100644
--- a/dashboardv3/public/css/scss/namespace.scss
+++ b/dashboardv3/public/css/scss/namespace.scss
@@ -30,7 +30,7 @@
                     width: 35%;
                 }
 
-                word-break: break-all;
+                word-break: break-word;
             }
         }
 
diff --git a/dashboardv3/public/js/templates/entity/EntityNameSpaceItemView_tmpl.html b/dashboardv3/public/js/templates/entity/EntityNameSpaceItemView_tmpl.html
index d030ee6..afbf46f 100644
--- a/dashboardv3/public/js/templates/entity/EntityNameSpaceItemView_tmpl.html
+++ b/dashboardv3/public/js/templates/entity/EntityNameSpaceItemView_tmpl.html
@@ -15,21 +15,25 @@
  * limitations under the License.
 -->
 {{#ifCond model "has" "isNew"}}
-<td class="custom-col-1">
-    {{{callmyfunction getNamespaceDroupdown nameSpaceCollection}}}
-</td>
-<td class="custom-col-0"> : </td>
-<td class="custom-col-1" data-id="value">
-    <input type="text" data-key disabled class="form-control">
-</td>
-<td class="custom-col-2 btn-group">
-    <button class="btn btn-default btn-sm" data-id="deleteItem">
-        <i class="fa fa-minus"> </i>
-    </button>
-    <button class="btn btn-default btn-sm" data-id="addItem">
-        <i class="fa fa-plus"> </i>
-    </button>
-</td>
+<table class="custom-table" style="font-weight: 100;">
+    <tr class="custom-tr">
+        <td class="custom-col-1">
+            {{{callmyfunction getNamespaceDroupdown nameSpaceCollection}}}
+        </td>
+        <td class="custom-col-0"> : </td>
+        <td class="custom-col-1" data-id="value">
+            <input type="text" data-key disabled class="form-control">
+        </td>
+        <td class="custom-col-2 btn-group">
+            <button class="btn btn-default btn-sm" data-id="deleteItem">
+                <i class="fa fa-minus"> </i>
+            </button>
+            <button class="btn btn-default btn-sm" data-id="addItem">
+                <i class="fa fa-plus"> </i>
+            </button>
+        </td>
+    </tr>
+</table>
 {{else}}
 <hr />
 <ul class="namespace-tree-parent">
diff --git a/dashboardv3/public/js/templates/entity/EntityNameSpaceView_tmpl.html b/dashboardv3/public/js/templates/entity/EntityNameSpaceView_tmpl.html
index 6b622d7..f4a9df3 100644
--- a/dashboardv3/public/js/templates/entity/EntityNameSpaceView_tmpl.html
+++ b/dashboardv3/public/js/templates/entity/EntityNameSpaceView_tmpl.html
@@ -24,7 +24,7 @@
         </div>
     </div>
     <div class="panel-actions">
-        <button class="btn btn-action btn-sm" title="" data-id="addNameSpace">Add</button>
+        <button class="btn btn-action btn-sm" data-id="addNameSpace">Add</button>
         <button class="btn btn-action btn-sm" style="display: none;" data-id="saveNameSpace">Save</button>
         <button class="btn btn-action btn-sm" style="display: none;" data-id="cancel">Cancel</button>
     </div>
@@ -35,9 +35,7 @@
                 <div class="form-group">
                     <a href="javascript:void(0)" class="btn btn-action btn-sm" data-id="addItem" data-type="addAttrButton">Add New Attribute</a>
                 </div>
-                <table class="custom-table">
-                    <tbody data-id="itemView"></tbody>
-                </table>
+                <ul class="namespace-tree-parent" data-id="itemView"></ul>
             </div>
         </div>
     </div>
diff --git a/dashboardv3/public/js/templates/name_space/NameSpaceAttributeItemView_tmpl.html b/dashboardv3/public/js/templates/name_space/NameSpaceAttributeItemView_tmpl.html
index f7bc9cd..f374ec4 100644
--- a/dashboardv3/public/js/templates/name_space/NameSpaceAttributeItemView_tmpl.html
+++ b/dashboardv3/public/js/templates/name_space/NameSpaceAttributeItemView_tmpl.html
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
-<div class="form-group clearfix namespace-attr">
+<div id="{{modalID}}" class="form-group clearfix namespace-attr">
     <div class="form-group">
         <div class="col-sm-12 attributePlusData " align="right">
             <button type="button" class="btn btn-danger btn-sm closeInput" data-id="close"><i class="fa fa-times"></i></button>
diff --git a/dashboardv3/public/js/views/entity/EntityNameSpaceItemView.js b/dashboardv3/public/js/views/entity/EntityNameSpaceItemView.js
index 29a87cf..4cde4bf 100644
--- a/dashboardv3/public/js/views/entity/EntityNameSpaceItemView.js
+++ b/dashboardv3/public/js/views/entity/EntityNameSpaceItemView.js
@@ -38,8 +38,8 @@ define(['require',
                 model: this.model.toJSON()
             }
         },
-        tagName: 'tr',
-        className: "custom-tr",
+        tagName: 'li',
+        className: "namespace-tree-child",
 
         /** Layout sub regions */
         regions: {},
@@ -142,9 +142,10 @@ define(['require',
                 });
             }
         },
-        getAttrElement: function(options) {
+        getAttrElement: function(opt) {
             var that = this,
-                returnEL = "N/A";
+                returnEL = "N/A",
+                options = $.extend(true, {}, opt);
             if (options) {
                 var key = options.key,
                     typeName = options.val.typeName || "",
@@ -153,24 +154,21 @@ define(['require',
                     namespace = options.namespace,
                     allowOnlyNum = false;
                 var elType = isMultiValued ? "select" : "input";
-                if (!_.isEmpty(val)) {
+                if (!isMultiValued && !_.isEmpty(val)) {
                     val = _.escape(val);
                 }
                 if (!_.isUndefinedNull(val) && typeName.indexOf("boolean") > -1) {
                     val = String(val);
                 }
                 if (typeName.indexOf("date") > -1) {
-                    if (isMultiValued && val) {
-                        var dateVlaues = val.split(',');
-                        if (dateVlaues.length) {
-                            var dateStr = [];
-                            _.each(dateVlaues, function(selectedDate) {
-                                selectedDate = parseInt(selectedDate);
-                                dateStr.push(moment(selectedDate).format("MM/DD/YYYY"));
-                            });
-                            val = dateStr.join(',');
-                        }
-                    } else if (val) {
+                    if (isMultiValued && val && val.length) {
+                        var dateStr = [];
+                        _.each(val, function(selectedDate) {
+                            selectedDate = parseInt(selectedDate);
+                            dateStr.push(moment(selectedDate).format("MM/DD/YYYY"));
+                        });
+                        val = dateStr.join(',');
+                    } else if (!isMultiValued && val) {
                         val = parseInt(val);
                         val = moment(val).format("MM/DD/YYYY");
                     }
@@ -199,13 +197,14 @@ define(['require',
                     allowOnlyNum = true;
                     returnEL = '<' + elType + ' data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '" type="number" data-multi="' + isMultiValued + '" data-tags="true" placeholder="Enter Number" class="form-control" ' + (!_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + '></' + elType + '>';
                 } else if (typeName) {
+                    var modTypeName = typeName;
                     if (isMultiValued) {
                         var multipleType = typeName.match("array<(.*)>");
                         if (multipleType && multipleType[1]) {
-                            typeName = multipleType[1];
+                            modTypeName = multipleType[1];
                         }
                     }
-                    var foundEnumType = this.enumDefCollection.fullCollection.find({ name: typeName });
+                    var foundEnumType = this.enumDefCollection.fullCollection.find({ name: modTypeName });
                     if (foundEnumType) {
                         var enumOptions = "";
                         _.forEach(foundEnumType.get("elementDefs"), function(obj) {
@@ -214,15 +213,17 @@ define(['require',
                         returnEL = '<select data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" >' + enumOptions + '</select>';
                     }
                     setTimeout(function() {
-                        var selectEl = that.$el.find('.custom-col-1[data-id="value"] select[data-key="' + key + '"]');
-                        selectEl.val((val || ""));
-                        selectEl.select2();
+                        if (!isMultiValued) {
+                            var selectEl = that.$el.find('.custom-col-1[data-id="value"] select[data-key="' + key + '"]');
+                            selectEl.val((val || ""));
+                            selectEl.select2();
+                        }
                     }, 0);
                 }
                 if (isMultiValued) {
                     setTimeout(function() {
                         var selectEl = that.$el.find('.custom-col-1[data-id="value"] select[data-key="' + key + '"][data-multi="true"]');
-                        var data = val && val.split(",") || [];
+                        var data = val && val.length && (_.isArray(val) ? val : val.split(",")) || [];
                         if (allowOnlyNum) {
                             selectEl.parent().addClass("select2_only_number");
                         }
@@ -323,7 +324,7 @@ define(['require',
                         '<button class="btn btn-default btn-sm" data-key="' + key + '" data-id="deleteItem">' +
                         '<i class="fa fa-times"> </i>' +
                         '</button></td>';
-                    trs += "<tr>" + td + "</tr>";
+                    trs += "<tr class='custom-tr'>" + td + "</tr>";
                 }
             })
             this.$("[data-id='namespaceTreeChild']").html("<table class='custom-table'>" + trs + "</table>");
diff --git a/dashboardv3/public/js/views/entity/EntityNameSpaceView.js b/dashboardv3/public/js/views/entity/EntityNameSpaceView.js
index 645fc3e..3210255 100644
--- a/dashboardv3/public/js/views/entity/EntityNameSpaceView.js
+++ b/dashboardv3/public/js/views/entity/EntityNameSpaceView.js
@@ -117,10 +117,8 @@ define([
                 this.$el.find(".panel-heading").addClass("collapsed");
                 this.$el.find(".panel-collapse.collapse").removeClass("in");
                 this.ui.addNameSpace.text("Add");
-                this.ui.addNameSpace.attr("data-original-title", "Add");
             } else {
                 this.ui.addNameSpace.text("Edit");
-                this.ui.addNameSpace.attr("data-original-title", "Edit All");
                 this.$el.find(".panel-heading").removeClass("collapsed");
                 this.$el.find(".panel-collapse.collapse").addClass("in");
             }
@@ -157,8 +155,13 @@ define([
             if (!this.validate()) {
                 return;
             }
+            var nData = this.generateData();
+            if (this.actualCollection.length === 0 && _.isEmpty(nData)) {
+                this.onCancel();
+                return;
+            }
             this.entityModel.saveNamespaceEntity(this.guid, {
-                data: JSON.stringify(this.generateData()),
+                data: JSON.stringify(nData),
                 type: "POST",
                 success: function(data) {
                     Utils.notifySuccess({
diff --git a/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js b/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js
index de1eedd..5cdd145 100644
--- a/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js
+++ b/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js
@@ -281,17 +281,67 @@ define(['require',
                     return true;
                 }
             },
+            namespaceAttributes: function(modelEl, obj, elementValues) {
+                obj.options = {
+                    "applicableEntityTypes": JSON.stringify(modelEl.find(".entityTypeSelector").val()),
+                    "maxStrLength": modelEl.find(".stringLengthVal").val() ? modelEl.find(".stringLengthVal").val() : "0"
+                };
+
+                if (obj.typeName != "string" && obj.typeName != "boolean" && obj.typeName != "byte" && obj.typeName != "short" && obj.typeName != "int" && obj.typeName != "float" && obj.typeName != "double" && obj.typeName != "long" && obj.typeName != "date") {
+                    var enumName = enumDefCollection.fullCollection.findWhere({ name: obj.typeName });
+                    if (enumName) {
+                        var enumDef = enumName.get('elementDefs');
+                        if (enumDef.length === obj.enumValues.length) {
+                            _.each(enumDef, function(enumVal, index) {
+                                if (obj.enumValues.indexOf(enumVal.value) === -1) {
+                                    this.isPutCall = true;
+                                };
+                            })
+                        } else {
+                            this.isPutCall = true;
+                        }
+                    } else {
+                        this.isPostCallEnum = true;
+                    }
+
+                    _.each(obj.enumValues, function(inputEnumVal, index) {
+                        elementValues.push({
+                            "ordinal": index + 1,
+                            "value": inputEnumVal
+                        })
+                    });
+                }
+                if (obj.multiValueSelect) {
+                    obj.multiValued = true;
+                    obj.typeName = "array<" + obj.typeName + ">";
+                }
+            },
+            highlightAttrinuteName: function(modelEl, obj) {
+                Utils.notifyInfo({
+                    content: "Attribute " + obj.name + " already exist"
+                });
+                modelEl.find(".attributeInput").css("borderColor", "red");
+                this.loaderStatus(false);
+            },
+            createEnumObject: function(arrayObj, obj, enumVal) {
+                return arrayObj.push({
+                    "name": obj.typeName,
+                    "elementDefs": enumVal
+                });
+            },
             onCreateNameSpace: function() {
                 var that = this,
                     validate = true,
                     attrNameValidate = true,
                     enumValue = true,
                     stringValidate = true,
-                    isPutCall = false,
-                    isPostCallEnum = false,
                     enumDefs = [],
-                    putEnumDef = [];
+                    putEnumDef = [],
+                    attrNames = [],
+                    isvalidName = true;
                 this.checkLoader = 0;
+                this.isPutCall = false;
+                this.isPostCallEnum = false;
 
                 if (this.validateValues()) {
                     return;
@@ -305,51 +355,22 @@ define(['require',
                 }
                 if (attributeObj.length) {
                     _.each(attributeObj, function(obj) {
-                        var isMultiCheck = obj.multiValueSelect;
-                        obj.options = {
-                            "applicableEntityTypes": JSON.stringify(that.$el.find(".entityTypeSelector").val()),
-                            "maxStrLength": that.$el.find(".stringLengthVal").val() ? that.$el.find(".stringLengthVal").val() : "0"
-                        };
-                        if (obj.typeName != "string" && obj.typeName != "boolean" && obj.typeName != "byte" && obj.typeName != "short" && obj.typeName != "int" && obj.typeName != "float" && obj.typeName != "double" && obj.typeName != "long" && obj.typeName != "date") {
-                            obj.typeName = obj.typeName;
-                            var enumName = enumDefCollection.fullCollection.findWhere({ name: obj.typeName });
-                            if (enumName) {
-                                var enumDef = enumName.get('elementDefs');
-                                if (enumDef.length === obj.enumValues.length) {
-                                    _.each(enumDef, function(enumVal, index) {
-                                        if (obj.enumValues.indexOf(enumVal.value) === -1) {
-                                            isPutCall = true;
-                                        };
-                                    })
-                                } else {
-                                    isPutCall = true;
-                                }
-                            } else {
-                                isPostCallEnum = true;
-                            }
-                            var elementValues = [];
-                            _.each(obj.enumValues, function(inputEnumVal, index) {
-                                elementValues.push({
-                                    "ordinal": index + 1,
-                                    "value": inputEnumVal
-                                })
-                            });
-                            if (isPostCallEnum) {
-                                enumDefs.push({
-                                    "name": obj.typeName,
-                                    "elementDefs": elementValues
-                                })
-                            }
-                            if (isPutCall) {
-                                putEnumDef.push({
-                                    "name": obj.typeName,
-                                    "elementDefs": elementValues
-                                })
-                            }
+                        var modelEl = this.$('#' + obj.modalID);
+                        modelEl.find(".attributeInput").css("borderColor", "transparent");;
+                        if (attrNames.indexOf(obj.name) > -1) {
+                            that.highlightAttrinuteName(modelEl, obj);
+                            isvalidName = false;
+                            return true;
+                        } else {
+                            attrNames.push(obj.name);
                         }
-                        if (isMultiCheck) {
-                            obj.multiValued = true;
-                            obj.typeName = "array<" + obj.typeName + ">";
+                        var elementValues = [];
+                        that.namespaceAttributes(modelEl, obj, elementValues);
+                        if (that.isPostCallEnum) {
+                            that.createEnumObject(enumDefs, obj, elementValues);
+                        }
+                        if (that.isPutCall) {
+                            that.createEnumObject(putEnumDef, obj, elementValues);
                         }
                     });
                     var notifyObj = {
@@ -368,210 +389,178 @@ define(['require',
                         }
                     };
                 }
-                this.json = {
-                    "enumDefs": enumDefs,
-                    "structDefs": [],
-                    "classificationDefs": [],
-                    "entityDefs": [],
-                    "namespaceDefs": [{
-                        "category": "NAMESPACE",
-                        "createdBy": "admin",
-                        "updatedBy": "admin",
-                        "version": 1,
-                        "typeVersion": "1.1",
-                        "name": name.trim(),
-                        "description": description.trim(),
-                        "attributeDefs": attributeObj
-                    }]
-                };
-
-                var apiObj = {
-                    sort: false,
-                    success: function(model, response) {
-                        var nameSpaveDef = model.namespaceDefs;
-                        if (nameSpaveDef) {
-                            that.options.nameSpaceCollection.fullCollection.add(nameSpaveDef);
-                            Utils.notifySuccess({
-                                content: "Namespace " + name + Messages.getAbbreviationMsg(false, 'addSuccessMessage')
-                            });
-                        }
-                        that.checkLoader--;
-                        if (that.checkLoader == 0) {
-                            that.options.onUpdateNamespace();
+                if (isvalidName) {
+                    this.json = {
+                        "enumDefs": enumDefs,
+                        "structDefs": [],
+                        "classificationDefs": [],
+                        "entityDefs": [],
+                        "namespaceDefs": [{
+                            "category": "NAMESPACE",
+                            "createdBy": "admin",
+                            "updatedBy": "admin",
+                            "version": 1,
+                            "typeVersion": "1.1",
+                            "name": name.trim(),
+                            "description": description.trim(),
+                            "attributeDefs": attributeObj
+                        }]
+                    };
+                    var apiObj = {
+                        sort: false,
+                        success: function(model, response) {
+                            var nameSpaveDef = model.namespaceDefs;
+                            if (nameSpaveDef) {
+                                that.options.nameSpaceCollection.fullCollection.add(nameSpaveDef);
+                                Utils.notifySuccess({
+                                    content: "Namespace " + name + Messages.getAbbreviationMsg(false, 'addSuccessMessage')
+                                });
+                            }
+                            that.checkLoader--;
+                            if (that.checkLoader == 0) {
+                                that.options.onUpdateNamespace();
+                            }
+                        },
+                        silent: true,
+                        reset: true,
+                        complete: function(model, status) {
+                            attrNames = [];
+                            that.loaderStatus(false);
                         }
-                    },
-                    silent: true,
-                    reset: true,
-                    complete: function(model, status) {
-                        that.loaderStatus(false);
                     }
-                }
-                that.checkLoader++;
-                $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(that.json) })
-                this.options.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.nameSpaceApiUrl(), "POST", apiObj);
-                if (isPutCall) {
-                    var putData = {
-                        "enumDefs": putEnumDef
-                    };
                     that.checkLoader++;
-                    $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(putData) })
-                    this.options.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.typedefsUrl().defs, "PUT", apiObj);
+                    $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(that.json) })
+                    this.options.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.nameSpaceApiUrl(), "POST", apiObj);
+                    if (that.isPutCall) {
+                        var putData = {
+                            "enumDefs": putEnumDef
+                        };
+                        that.checkLoader++;
+                        $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(putData) })
+                        this.options.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.typedefsUrl().defs, "PUT", apiObj);
+                    }
+                } else {
+                    attrNames = [];
                 }
+
             },
             onUpdateAttr: function() {
                 var that = this,
                     attrNameValidate = true,
                     enumValue = true,
                     stringValidate = true,
-                    attributeDefs = that.options.selectedNamespace.get('attributeDefs'),
                     enumDefs = [],
                     postEnumDef = [],
-                    isPutCall = false,
-                    isPostCallEnum = false;
+                    selectedNamespace = $.extend(true, {}, that.options.selectedNamespace.toJSON()),
+                    attributeDefs = selectedNamespace['attributeDefs'],
+                    isvalidName = true;
                 this.checkLoader = 0;
+                this.isPutCall = false;
+                this.isPostCallEnum = false;
                 if (this.validateValues()) {
                     return;
                 };
                 if (this.$el.find(".namespace-attr").length > 0 && this.collection.length > 0) {
-
                     this.loaderStatus(true);
-                    var attributeObj = this.collection.toJSON(),
-                        name = this.collection.first().get("name"),
-                        multipleName = '';
-                    if (this.collection.length === 1 && this.collection.first().get("name") === "") {
-                        attributeObj = [];
-                    }
-                    if (attributeObj.length > 0) {
-                        _.each(attributeObj, function(obj) {
-                            var isMultiCheck = obj.multiValueSelect;
-                            multipleName += obj.name + ", ";
-                            obj.options = {
-                                "applicableEntityTypes": JSON.stringify(that.$el.find(".entityTypeSelector").val()),
-                                "maxStrLength": that.$el.find(".stringLengthVal").val() ? that.$el.find(".stringLengthVal").val() : "0"
-                            };
-                            if (obj.typeName != "string" && obj.typeName != "boolean" && obj.typeName != "byte" && obj.typeName != "short" && obj.typeName != "int" && obj.typeName != "float" && obj.typeName != "double" && obj.typeName != "long" && obj.typeName != "date") {
-                                var enumName = enumDefCollection.fullCollection.findWhere({ name: obj.typeName });
-                                if (enumName) {
-                                    var enumDef = enumName.get('elementDefs');
-                                    if (enumDef.length === obj.enumValues.length) {
-                                        _.each(enumDef, function(enumVal, index) {
-                                            if (obj.enumValues.indexOf(enumVal.value) === -1) {
-                                                isPutCall = true;
-                                            };
-                                        })
-                                    } else {
-                                        isPutCall = true;
-                                    }
-                                } else {
-                                    isPostCallEnum = true;
-                                }
-                                var elementValues = [];
-                                _.each(obj.enumValues, function(inputEnumVal, index) {
-                                    elementValues.push({
-                                        "ordinal": index + 1,
-                                        "value": inputEnumVal
-                                    })
-                                });
-                                if (isPostCallEnum) {
-                                    postEnumDef.push({
-                                        "name": obj.typeName,
-                                        "elementDefs": elementValues
-                                    })
-
-                                } else if (isPutCall) {
-                                    enumDefs.push({
-                                        "name": obj.typeName,
-                                        "elementDefs": elementValues
-                                    })
-                                }
+                    if (this.collection.length > 0) {
+                        this.collection.each(function(model) {
+                            var obj = model.toJSON(),
+                                modelEl = this.$('#' + obj.modalID);
+                            modelEl.find(".attributeInput").css("borderColor", "transparent");
+                            if (that.options.isNewAttr == true && _.find(attributeDefs, { name: obj.name })) {
+                                that.highlightAttrinuteName(modelEl, obj);
+                                isvalidName = false;
+                                return true;
                             }
-                            if (isMultiCheck) {
-                                obj.multiValued = true;
-                                obj.typeName = "array<" + obj.typeName + ">";
+                            var elementValues = [];
+                            that.namespaceAttributes(modelEl, obj, elementValues);
+                            if (that.isPostCallEnum) {
+                                that.createEnumObject(postEnumDef, obj, elementValues);
+                            } else if (that.isPutCall) {
+                                that.createEnumObject(enumDefs, obj, elementValues);
                             }
 
-                        });
-                        var notifyObj = {
-                            modal: true,
-                            confirm: {
-                                confirm: true,
-                                buttons: [{
-                                        text: "Ok",
-                                        addClass: "btn-atlas btn-md",
-                                        click: function(notice) {
-                                            notice.remove();
-                                        }
-                                    },
-                                    null
-                                ]
-                            }
-                        };
-                        if (that.options.isNewAttr == true) {
-                            _.each(attributeObj, function(obj) {
-                                attributeDefs.push(obj);
-                            })
-                        } else {
-                            var selectedNamespaceUpdateCopy = that.options.selectedNamespace;
-                            var attrDef = selectedNamespaceUpdateCopy.toJSON().attributeDefs;
-                            _.each(attrDef, function(attrObj) {
-                                if (attrObj.name === that.$el.find(".attributeInput")[0].value) {
-                                    attrObj.name = attributeObj[0].name;
-                                    attrObj.typeName = attributeObj[0].typeName;
-                                    attrObj.multiValued = attributeObj[0].multiValueSelect || false;
-                                    attrObj.options.applicableEntityTypes = attributeObj[0].options.applicableEntityTypes;
-                                    attrObj.enumValues = attributeObj[0].enumValues;
-                                    attrObj.options.maxStrLength = attributeObj[0].options.maxStrLength;
-                                }
-                            });
-                        }
-                        var putNameSpace = function() {
-                            that.checkLoader++;
-                            $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(that.json) })
-                            that.options.nameSpaceCollection.constructor.nonCrudOperation.call(that, UrlLinks.nameSpaceUpdateUrl(), "PUT", apiObj);
-                        }
-                        this.json = {
-                            "enumDefs": enumDefs,
-                            "structDefs": [],
-                            "classificationDefs": [],
-                            "entityDefs": [],
-                            "namespaceDefs": that.options.isNewAttr ? [that.options.selectedNamespace.toJSON()] : [selectedNamespaceUpdateCopy.toJSON()]
-                        };
-                        var apiObj = {
-                            sort: false,
-                            success: function(model, response) {
-                                if (model.namespaceDefs.length === 0 && model.enumDefs.length) {
-                                    putNameSpace();
-                                } else {
-                                    var selectedNameSpace = that.options.nameSpaceCollection.fullCollection.findWhere({ guid: that.options.guid });
-                                    Utils.notifySuccess({
-                                        content: "One or more Namespace attribute" + Messages.getAbbreviationMsg(false, 'editSuccessMessage')
-                                    });
-                                    if (model.namespaceDefs && model.namespaceDefs.length) {
-                                        that.options.selectedNamespace.set(model.namespaceDefs[0]);
+                            if (that.options.isNewAttr == true) {
+                                selectedNamespace.attributeDefs.push(obj);
+                            } else {
+                                var attrDef = selectedNamespace.attributeDefs;
+                                _.each(attrDef, function(attrObj) {
+                                    if (attrObj.name === that.$el.find(".attributeInput")[0].value) {
+                                        attrObj.name = obj.name;
+                                        attrObj.typeName = obj.typeName;
+                                        attrObj.multiValued = obj.multiValueSelect || false;
+                                        attrObj.options.applicableEntityTypes = obj.options.applicableEntityTypes;
+                                        attrObj.enumValues = obj.enumValues;
+                                        attrObj.options.maxStrLength = obj.options.maxStrLength;
                                     }
-                                    that.options.onEditCallback();
-                                }
-                                that.checkLoader--;
-                                if (that.checkLoader == 0) {
-                                    that.options.onUpdateNamespace();
+                                });
+                            }
+                        });
+                        if (isvalidName) {
+                            var notifyObj = {
+                                modal: true,
+                                confirm: {
+                                    confirm: true,
+                                    buttons: [{
+                                            text: "Ok",
+                                            addClass: "btn-atlas btn-md",
+                                            click: function(notice) {
+                                                notice.remove();
+                                            }
+                                        },
+                                        null
+                                    ]
                                 }
+                            };
 
-                            },
-                            silent: true,
-                            reset: true,
-                            complete: function(model, status) {
-                                that.loaderStatus(false);
+                            var putNameSpace = function() {
+                                that.checkLoader++;
+                                $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(that.json) })
+                                that.options.nameSpaceCollection.constructor.nonCrudOperation.call(that, UrlLinks.nameSpaceUpdateUrl(), "PUT", apiObj);
                             }
-                        }
-                        if (isPostCallEnum) {
-                            var postData = {
-                                "enumDefs": postEnumDef
+                            this.json = {
+                                "enumDefs": enumDefs,
+                                "structDefs": [],
+                                "classificationDefs": [],
+                                "entityDefs": [],
+                                "namespaceDefs": that.options.isNewAttr ? [selectedNamespace] : [selectedNamespace]
                             };
-                            this.checkLoader++;
-                            $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(postData) })
-                            this.options.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.typedefsUrl().defs, "POST", apiObj);
-                        } else {
-                            putNameSpace();
+                            var apiObj = {
+                                sort: false,
+                                success: function(model, response) {
+                                    if (model.namespaceDefs.length === 0 && model.enumDefs.length) {
+                                        putNameSpace();
+                                    } else {
+                                        var selectedNameSpace = that.options.nameSpaceCollection.fullCollection.findWhere({ guid: that.options.guid });
+                                        Utils.notifySuccess({
+                                            content: "One or more Namespace attribute" + Messages.getAbbreviationMsg(false, 'editSuccessMessage')
+                                        });
+                                        if (model.namespaceDefs && model.namespaceDefs.length) {
+                                            that.options.selectedNamespace.set(model.namespaceDefs[0]);
+                                        }
+                                        that.options.onEditCallback();
+                                    }
+                                    that.checkLoader--;
+                                    if (that.checkLoader == 0) {
+                                        that.options.onUpdateNamespace();
+                                    }
+                                },
+                                silent: true,
+                                reset: true,
+                                complete: function(model, status) {
+                                    that.loaderStatus(false);
+                                }
+                            }
+                            if (that.isPostCallEnum) {
+                                var postData = {
+                                    "enumDefs": postEnumDef
+                                };
+                                this.checkLoader++;
+                                $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(postData) })
+                                this.options.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.typedefsUrl().defs, "POST", apiObj);
+                            } else {
+                                putNameSpace();
+                            }
                         }
                     }
                 } else {
diff --git a/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js b/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js
index 2388ce3..4f42288 100644
--- a/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js
+++ b/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js
@@ -89,12 +89,20 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
                     entitytypes = "",
                     enumTypes = [];
                 this.ui.enumValueSelectorContainer.hide();
+                this.bindEvents();
                 this.emumTypeSelectDisplay();
                 if (!this.options.closeModal) {
                     this.ui.enumCancleBtn.attr("disabled", "true");
                     this.ui.enumCancleBtn.text("Clear");
                 }
             },
+            bindEvents: function() {
+                var that = this;
+                this.listenTo(this.enumDefCollection, 'reset', function() {
+                    that.emumTypeSelectDisplay();
+                })
+            },
+
             showEnumValues: function(enumName) {
                 var enumValues = "",
                     selectedValues = [],
@@ -225,7 +233,8 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
                                 content: "Enumeration " + selectedEnumName + " updated successfully"
                             });
                         }
-                        if (that.options.onUpdateEnum) {
+                        that.enumDefCollection.fetch({ reset: true });
+                        if (that.options.onUpdateEnum) { //callback from namespaceattributeItemView
                             that.options.onUpdateEnum();
                         }
                         that.ui.enumCancleBtn.attr("disabled", "true");
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js b/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js
index b537e41..a8837f9 100644
--- a/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js
+++ b/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js
@@ -30,6 +30,11 @@ define(['require',
         {
 
             template: NameSpaceAttributeItemViewTmpl,
+            templateHelpers: function() {
+                return {
+                    modalID: this.viewId
+                };
+            },
 
             /** Layout sub regions */
             regions: {},
@@ -109,12 +114,14 @@ define(['require',
              */
             initialize: function(options) {
                 this.parentView = options.parentView;
+                this.viewId = options.model ? options.model.cid : this.parentView.cid;
 
             },
             onRender: function() {
                 var that = this,
                     entitytypes = '',
                     enumTypes = [];
+                this.model.set({ "modalID": this.viewId });
                 this.parentView.typeHeaders.fullCollection.each(function(model) {
                     if (model.toJSON().category == "ENTITY") {
                         that.ui.entityTypeSelector.append("<option>" + model.get('name') + "</option>");
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js b/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js
index 390542b..3697d91 100644
--- a/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js
+++ b/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js
@@ -151,15 +151,15 @@ define(['require',
             },
             onEditAttr: function(e) {
                 var that = this,
-                    isAttrEdit = e.target.dataset && e.target.dataset.id === 'attributeEdit' ? true : false,
-                    guid = e.target.dataset && e.target.dataset.guid ? e.target.dataset.guid : null,
+                    isAttrEdit = e.currentTarget.dataset && e.currentTarget.dataset.id === 'attributeEdit' ? true : false,
+                    guid = e.currentTarget.dataset && e.currentTarget.dataset.guid ? e.currentTarget.dataset.guid : null,
                     selectedNamespace = that.nameSpaceCollection.fullCollection.findWhere({ guid: guid }),
                     attrributes = selectedNamespace ? selectedNamespace.get('attributeDefs') : null,
-                    attrName = e.target.dataset.name ? e.target.dataset.name : null,
+                    attrName = e.currentTarget.dataset.name ? e.currentTarget.dataset.name : null,
                     attrDetails = { name: attrName };
                 if (selectedNamespace) {
                     that.ui.namespaceAttrPageOk.text("Save");
-                    that.newAttr = e.target && e.target.dataset.action === "createAttr" ? true : false;
+                    that.newAttr = e.currentTarget && e.currentTarget.dataset.action === "createAttr" ? true : false;
                     that.guid = guid;
                     _.each(attrributes, function(attrObj) {
                         if (attrObj.name === attrName) {
@@ -176,7 +176,7 @@ define(['require',
 
                     that.showDetails = false;
                     that.toggleNamespaceDetailsAttrView();
-                    that.ui.namespaceAttrPageOk.attr('data-action', e.target.dataset.id);
+                    that.ui.namespaceAttrPageOk.attr('data-action', e.currentTarget.dataset.id);
                     require(["views/name_space/CreateNameSpaceLayoutView"], function(CreateNameSpaceLayoutView) {
                         that.view = new CreateNameSpaceLayoutView({
                             onEditCallback: function() {