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:41 UTC
[atlas] branch branch-2.0 updated (8d9c06f -> bf1c828)
This is an automated email from the ASF dual-hosted git repository.
kbhatt pushed a change to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git.
from 8d9c06f ATLAS-3629 : UI: skipDefaultError handler improvement (2 patch)
new 139a79a ATLAS-3624 : Beta UI : Allow user to add mutlti-valued attributes in namespaces
new bf1c828 ATLAS-3636 : [Namespace-UI] Issues/ambiguous error messages while adding a new attribute in a Namespace
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
dashboardv3/public/css/scss/common.scss | 8 +-
dashboardv3/public/css/scss/namespace.scss | 18 +-
.../detail_page/DetailPageLayoutView_tmpl.html | 6 +-
.../entity/EntityNameSpaceItemView_tmpl.html | 34 +-
.../templates/entity/EntityNameSpaceView_tmpl.html | 6 +-
.../NameSpaceAttributeItemView_tmpl.html | 6 +-
dashboardv3/public/js/templates/site/Header.html | 2 +-
dashboardv3/public/js/utils/Globals.js | 3 +-
dashboardv3/public/js/utils/Utils.js | 4 +
.../views/administrator/AdministratorLayoutView.js | 4 +-
.../public/js/views/audit/AuditTableLayoutView.js | 1 +
.../js/views/detail_page/DetailPageLayoutView.js | 6 +-
.../js/views/entity/EntityNameSpaceItemView.js | 132 ++++--
.../public/js/views/entity/EntityNameSpaceView.js | 75 ++--
.../views/name_space/CreateNameSpaceLayoutView.js | 441 ++++++++++-----------
.../views/name_space/EnumCreateUpdateItemView.js | 19 +-
.../name_space/NameSpaceAttrTableLayoutView.js | 5 +-
.../views/name_space/NameSpaceAttributeItemView.js | 31 +-
.../name_space/NameSpaceContainerLayoutView.js | 3 +-
.../views/name_space/NameSpaceTableLayoutView.js | 18 +-
.../public/js/views/search/QueryBuilderView.js | 36 +-
.../views/search/SearchFilterBrowseLayoutView.js | 2 +-
.../js/views/search/SearchResultLayoutView.js | 17 +-
.../views/search/tree/NameSpaceTreeLayoutView.js | 79 +---
dashboardv3/public/js/views/site/Header.js | 11 +
25 files changed, 512 insertions(+), 455 deletions(-)
[atlas] 02/02: ATLAS-3636 : [Namespace-UI] Issues/ambiguous error
messages while adding a new attribute in a Namespace
Posted by kb...@apache.org.
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() {
[atlas] 01/02: ATLAS-3624 : Beta UI : Allow user to add
mutlti-valued attributes in namespaces
Posted by kb...@apache.org.
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 139a79a2433d77619ceccf4d9fdede2d6645e533
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Mon Feb 24 14:25:10 2020 +0530
ATLAS-3624 : Beta UI : Allow user to add mutlti-valued attributes in namespaces
(cherry picked from commit 58a58956e30c2d0699ead083aca6f27803394555)
---
dashboardv3/public/css/scss/namespace.scss | 18 +++-
.../detail_page/DetailPageLayoutView_tmpl.html | 6 +-
.../NameSpaceAttributeItemView_tmpl.html | 4 +-
dashboardv3/public/js/templates/site/Header.html | 2 +-
dashboardv3/public/js/utils/Globals.js | 3 +-
dashboardv3/public/js/utils/Utils.js | 4 +
.../views/administrator/AdministratorLayoutView.js | 4 +-
.../public/js/views/audit/AuditTableLayoutView.js | 1 +
.../js/views/detail_page/DetailPageLayoutView.js | 6 +-
.../js/views/entity/EntityNameSpaceItemView.js | 109 +++++++++++++++------
.../public/js/views/entity/EntityNameSpaceView.js | 66 ++++++-------
.../views/name_space/CreateNameSpaceLayoutView.js | 8 +-
.../views/name_space/EnumCreateUpdateItemView.js | 8 ++
.../name_space/NameSpaceAttrTableLayoutView.js | 5 +-
.../views/name_space/NameSpaceAttributeItemView.js | 24 ++---
.../name_space/NameSpaceContainerLayoutView.js | 3 +-
.../views/name_space/NameSpaceTableLayoutView.js | 8 +-
.../public/js/views/search/QueryBuilderView.js | 36 +++----
.../views/search/SearchFilterBrowseLayoutView.js | 2 +-
.../js/views/search/SearchResultLayoutView.js | 17 +++-
.../views/search/tree/NameSpaceTreeLayoutView.js | 79 +++------------
dashboardv3/public/js/views/site/Header.js | 11 +++
22 files changed, 233 insertions(+), 191 deletions(-)
diff --git a/dashboardv3/public/css/scss/namespace.scss b/dashboardv3/public/css/scss/namespace.scss
index c74c697..b5952ae 100644
--- a/dashboardv3/public/css/scss/namespace.scss
+++ b/dashboardv3/public/css/scss/namespace.scss
@@ -24,8 +24,19 @@
}
.namespace-tree-child {
- padding-left: 20px;
+ &.entity-detail-table table {
+ td {
+ &:nth-child(1) {
+ width: 35%;
+ }
+
+ word-break: break-all;
+ }
+ }
+
+ padding-left: 5px;
margin-top: 10px;
+ font-weight: 100;
}
}
@@ -61,8 +72,8 @@
.expandable .attr-details {
max-height: 300px;
overflow: auto;
- margin-left: 100px;
- width: calc(100% - 100px);
+ margin-left: 30px;
+ width: calc(100% - 30px);
}
}
@@ -124,7 +135,6 @@
.name-space-details {
.backgrid {
td.expandable-content {
- width: 100%;
max-width: none;
background: #f8f8f8;
diff --git a/dashboardv3/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html b/dashboardv3/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html
index 1eb68e3..94518a1 100644
--- a/dashboardv3/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html
@@ -77,7 +77,11 @@
</div>
</div>
<div class="col-md-6">
- <div id="r_entityUserDefineView"></div>
+ <div id="r_entityUserDefineView">
+ <div class="fontLoader-relative">
+ <i class="fa fa-refresh fa-spin-custom"></i>
+ </div>
+ </div>
<div id="r_entityLabelDefineView"></div>
<div id="r_entityNameSpaceView"></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 2afc3df..f7bc9cd 100644
--- a/dashboardv3/public/js/templates/name_space/NameSpaceAttributeItemView_tmpl.html
+++ b/dashboardv3/public/js/templates/name_space/NameSpaceAttributeItemView_tmpl.html
@@ -44,12 +44,12 @@
</select>
</div>
</div>
- <!-- <div class="form-group" data-id="multiValueSelect">
+ <div class="form-group" data-id="multiValueSelect">
<label class="control-label col-sm-3" for="multiValSelect">Enable Multivalues</label>
<div class="col-sm-8">
<input type="checkbox" class="form-check-input multi-value-select" data-id="multiValueSelectStatus">
</div>
- </div> -->
+ </div>
<div class="form-group enumtype-container" data-id="enumTypeSelectorContainer">
<div class="">
<label class="control-label col-sm-3 required" for="enumType">Enum Name</label>
diff --git a/dashboardv3/public/js/templates/site/Header.html b/dashboardv3/public/js/templates/site/Header.html
index 8448964..1eefe0d 100644
--- a/dashboardv3/public/js/templates/site/Header.html
+++ b/dashboardv3/public/js/templates/site/Header.html
@@ -42,7 +42,7 @@
</tr>
</table>
<ul class="dropdown-menu pull-right multi-level" role="menu" aria-labelledby="dropdownMenu">
- <li><a href="#!/administrator" data-id="purgeSearch">Administration</a></li>
+ <li><a href="javascript:void(0)" data-id='administrator'>Administration</a></li>
<li class="dropdown-submenu">
<a tabindex="-1" href="javascript:void(0)"> Help </span></a>
<ul class="dropdown-menu">
diff --git a/dashboardv3/public/js/utils/Globals.js b/dashboardv3/public/js/utils/Globals.js
index 53bc51e..d90e262 100644
--- a/dashboardv3/public/js/utils/Globals.js
+++ b/dashboardv3/public/js/utils/Globals.js
@@ -28,7 +28,8 @@ define(['require'], function(require) {
stateChanged: false,
tagUrl: "#!/tag",
searchUrl: "#!/search",
- glossaryUrl: "#!/glossary"
+ glossaryUrl: "#!/glossary",
+ administratorUrl: "#!/administrator"
},
detailPageState: {}
};
diff --git a/dashboardv3/public/js/utils/Utils.js b/dashboardv3/public/js/utils/Utils.js
index 1a5b3bc..8f18fc5 100644
--- a/dashboardv3/public/js/utils/Utils.js
+++ b/dashboardv3/public/js/utils/Utils.js
@@ -340,6 +340,8 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
urlUpdate['searchUrl'] = options.url;
} else if (Utils.getUrlState.isGlossaryTab(options.url)) {
urlUpdate['glossaryUrl'] = options.url;
+ } else if (Utils.getUrlState.isAdministratorTab(options.url)) {
+ urlUpdate['administratorUrl'] = options.url;
}
$.extend(Globals.saveApplicationState.tabState, urlUpdate);
}
@@ -561,6 +563,8 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
urlPath = "tagUrl";
} else if (queryParams.from == "glossary") {
urlPath = "glossaryUrl";
+ } else if (queryParams.from == "namespace") {
+ urlPath = "administratorUrl";
}
}
Utils.setUrl({
diff --git a/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js b/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js
index 722059f..f0633c1 100644
--- a/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js
+++ b/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js
@@ -67,7 +67,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
- _.extend(this, _.pick(options, 'value', 'guid', 'entity', 'entityName', 'attributeDefs', 'nameSpaceCollection', 'enumDefCollection'));
+ _.extend(this, _.pick(options, 'value', 'guid', 'entity', 'entityName', 'attributeDefs', 'entityDefCollection', 'nameSpaceCollection', 'enumDefCollection'));
},
onShow: function() {
@@ -87,7 +87,7 @@ define(['require',
renderNameSpaceLayoutView: function(obj) {
var that = this;
require(['views/name_space/NameSpaceTableLayoutView'], function(NameSpaceTableLayoutView) {
- that.RNamespaceTableLayoutView.show(new NameSpaceTableLayoutView({ nameSpaceCollection: that.nameSpaceCollection }));
+ that.RNamespaceTableLayoutView.show(new NameSpaceTableLayoutView({ nameSpaceCollection: that.nameSpaceCollection, entityDefCollection: that.entityDefCollection }));
});
},
renderEnumLayoutView: function(obj) {
diff --git a/dashboardv3/public/js/views/audit/AuditTableLayoutView.js b/dashboardv3/public/js/views/audit/AuditTableLayoutView.js
index ea52a45..65b8818 100644
--- a/dashboardv3/public/js/views/audit/AuditTableLayoutView.js
+++ b/dashboardv3/public/js/views/audit/AuditTableLayoutView.js
@@ -185,6 +185,7 @@ define(['require',
cell: "html",
editable: false,
sortable: false,
+ fixWidth: "20",
cell: Backgrid.ExpandableCell,
accordion: false,
expand: function(el, model) {
diff --git a/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js
index c2511b9..5bf4230 100644
--- a/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js
+++ b/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js
@@ -245,7 +245,7 @@ define(['require',
enumDefCollection: this.enumDefCollection,
classificationDefCollection: this.classificationDefCollection,
glossaryCollection: this.glossaryCollection,
- nameSpaceCollection: this.nameSpaceCollection,
+ nameSpaceCollection: this.activeEntityDef.get('namespaceAttributeDefs'),
searchVent: this.searchVent,
attributeDefs: (function() {
return that.getEntityDef(collectionJSON);
@@ -255,7 +255,9 @@ define(['require',
this.renderEntityDetailTableLayoutView(obj);
this.renderEntityUserDefineView(obj);
this.renderEntityLabelDefineView(obj);
- this.renderEntityNameSpaceView(obj);
+ if (obj.nameSpaceCollection) {
+ this.renderEntityNameSpaceView(obj);
+ }
this.renderRelationshipLayoutView(obj);
this.renderAuditTableLayoutView(obj);
this.renderTagTableLayoutView(obj);
diff --git a/dashboardv3/public/js/views/entity/EntityNameSpaceItemView.js b/dashboardv3/public/js/views/entity/EntityNameSpaceItemView.js
index 9982e14..29a87cf 100644
--- a/dashboardv3/public/js/views/entity/EntityNameSpaceItemView.js
+++ b/dashboardv3/public/js/views/entity/EntityNameSpaceItemView.js
@@ -34,7 +34,7 @@ define(['require',
entity: this.entity,
getValue: this.getValue.bind(this),
getNamespaceDroupdown: this.getNamespaceDroupdown.bind(this),
- nameSpaceCollection: this.nameSpaceCollection.fullCollection.toJSON(),
+ nameSpaceCollection: this.nameSpaceCollection,
model: this.model.toJSON()
}
},
@@ -107,18 +107,36 @@ define(['require',
if (_.isUndefinedNull(updateObj[key])) {
updateObj[key] = { value: null, typeName: typeName };
}
- updateObj[key].value = multi ? $(this).select2("val") : e.currentTarget.value;
+ updateObj[key].value = e.currentTarget.value;
+ if (multi && typeName.indexOf("date") == -1) {
+ updateObj[key].value = $(this).select2("val");
+ }
if (!that.model.has("__internal_UI_nameSpaceName")) {
updateObj["__internal_UI_nameSpaceName"] = namespace;
}
- if (typeName === "date") {
- updateObj[key].value = new Date(updateObj[key].value).getTime()
+ if (typeName.indexOf("date") > -1) {
+ if (multi && updateObj[key].value) {
+ var dateValues = updateObj[key].value.split(','),
+ dateStr = [];
+ if (dateValues.length) {
+ _.each(dateValues, function(selectedDate) {
+ dateStr.push(new Date(selectedDate.trim()).getTime());
+ });
+ updateObj[key].value = dateStr;
+ }
+ } else {
+ updateObj[key].value = new Date(updateObj[key].value).getTime()
+ }
}
that.model.set(updateObj);
});
this.$el.on('keypress', '.select2_only_number .select2-search__field', function() {
- $(this).val($(this).val().replace(/[^\d].+/, ""));
+ var typename = $(this).parents(".select2_only_number").find("select[data-typename]").data("typename")
+ if (typename.indexOf("float") > -1 && event.which == 46) {
+ return;
+ }
if ((event.which < 48 || event.which > 57)) {
+
event.preventDefault();
}
});
@@ -138,33 +156,62 @@ define(['require',
if (!_.isEmpty(val)) {
val = _.escape(val);
}
- if (typeName === "boolean") {
+ if (!_.isUndefinedNull(val) && typeName.indexOf("boolean") > -1) {
val = String(val);
}
- if (typeName === "date" && _.isNumber(val)) {
- val = moment(val).format("MM/DD/YYYY");
+ 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) {
+ val = parseInt(val);
+ val = moment(val).format("MM/DD/YYYY");
+ }
}
if (typeName.indexOf("string") > -1) {
- returnEL = '<' + elType + ' type="text" data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" multiple="' + isMultiValued + '" placeholder="Enter String" class="form-control" ' + (!_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + '></' + elType + '>';
- } else if (typeName === "boolean") {
- returnEL = '<select data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '" class="form-control"><option value="">--Select Value--</option><option value="true" ' + (!_.isUndefinedNull(val) && val == "true" ? "selected" : "") + '>true</option><option value="false" ' + (!_.isUndefinedNull(val) && val == "false" ? "selected" : "") + '>false</option></select>';
- } else if (typeName === "date") {
- returnEL = '<input type="text" data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '" data-type="date" class="form-control" ' + (!_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + '>'
+ returnEL = '<' + elType + ' type="text" data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" data-tags="true" placeholder="Enter String" class="form-control" ' + (!_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + '></' + elType + '>';
+ } else if (typeName.indexOf("boolean") > -1) {
+ returnEL = '<select data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" class="form-control">' + (isMultiValued ? "" : '<option value="">--Select Value--</option>') + '<option value="true" ' + (!_.isUndefinedNull(val) && val == "true" ? "selected" : "") + '>true</option><option value="false" ' + (!_.isUndefinedNull(val) && val == "false" ? "selected" : "") + '>false</option></select>';
+ } else if (typeName.indexOf("date") > -1) {
+ returnEL = '<' + (isMultiValued ? "textarea" : "input") + ' type="text" data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '"data-multi="' + isMultiValued + '" data-type="date" class="form-control" ' + (isMultiValued === false && !_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + '>' + (isMultiValued === true && !_.isUndefinedNull(val) ? val : "") + (isMultiValued ? "</textarea>" : "");
setTimeout(function() {
- var dateObj = { "singleDatePicker": true, "showDropdowns": true };
- that.$el.find('input[data-type="date"]').daterangepicker(dateObj);
+ var dateObj = { "singleDatePicker": true, autoUpdateInput: isMultiValued ? false : true },
+ dateEl = that.$el.find('[data-type="date"][data-key="' + key + '"]').daterangepicker(dateObj);
+ if (isMultiValued) {
+ dateEl.on("apply.daterangepicker", function(ev, picker) {
+ var val = picker.element.val();
+ if (val !== "") {
+ val += ", ";
+ }
+ picker.element.val(val += picker.startDate.format('MM/DD/YYYY'));
+ that.$el.find(".custom-col-1[data-id='value']>[data-key]").trigger('change');
+ });
+ }
}, 0);
- } else if (typeName === "byte" || typeName === "short" || typeName.indexOf("int") > -1 || typeName.indexOf("float") > -1 || typeName === "double" || typeName === "long") {
+ } else if (typeName.indexOf("byte") > -1 || typeName.indexOf("short") > -1 || typeName.indexOf("int") > -1 || typeName.indexOf("float") > -1 || typeName.indexOf("double") > -1 || typeName.indexOf("long") > -1) {
allowOnlyNum = true;
- returnEL = '<' + elType + ' data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '" type="number" data-multi="' + isMultiValued + '" multiple="' + isMultiValued + '" placeholder="Enter Number" class="form-control" ' + (!_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + '></' + elType + '>';
+ 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) {
+ if (isMultiValued) {
+ var multipleType = typeName.match("array<(.*)>");
+ if (multipleType && multipleType[1]) {
+ typeName = multipleType[1];
+ }
+ }
var foundEnumType = this.enumDefCollection.fullCollection.find({ name: typeName });
if (foundEnumType) {
var enumOptions = "";
_.forEach(foundEnumType.get("elementDefs"), function(obj) {
enumOptions += '<option value="' + obj.value + '">' + obj.value + '</option>'
});
- returnEL = '<select data-key="' + key + '" data-namespace="' + namespace + '" data-typename="' + typeName + '">' + enumOptions + '</select>';
+ 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 + '"]');
@@ -179,7 +226,11 @@ define(['require',
if (allowOnlyNum) {
selectEl.parent().addClass("select2_only_number");
}
- selectEl.select2({ tags: true, multiple: true, data: data });
+ selectEl.select2({
+ tags: selectEl.data("tags") ? true : false,
+ multiple: true,
+ data: data
+ });
selectEl.val(data).trigger("change");
}, 0);
}
@@ -226,28 +277,28 @@ define(['require',
if (keys.length === 1) {
isSelected = true;
}
- _.each(nameSpaceCollection, function(obj) {
+ _.each(nameSpaceCollection, function(obj, key) {
var options = "";
- if (obj.attributeDefs.length) {
- _.each(obj.attributeDefs, function(attrObj) {
- var entityNamespace = that.model.collection.filter({ __internal_UI_nameSpaceName: obj.name }),
+ if (obj.length) {
+ _.each(obj, function(attrObj) {
+ var entityNamespace = that.model.collection.filter({ __internal_UI_nameSpaceName: key }),
hasAttr = false;
if (entityNamespace) {
- var found = entityNamespace.find(function(obj) {
- return obj.attributes.hasOwnProperty(attrObj.name);
+ var found = entityNamespace.find(function(eObj) {
+ return eObj.attributes.hasOwnProperty(attrObj.name);
});
if (found) {
hasAttr = true;
}
}
- if ((isSelected && keys[0] === attrObj.name) || !(hasAttr) && attrObj.options.applicableEntityTypes.indexOf('"' + that.entity.typeName + '"') > -1) {
- var value = obj.name + ":" + attrObj.name + ":" + attrObj.typeName;
+ if ((isSelected && keys[0] === attrObj.name) || !(hasAttr)) {
+ var value = key + ":" + attrObj.name + ":" + attrObj.typeName;
if (isSelected && keys[0] === attrObj.name) { selectdVal = value };
options += '<option value="' + value + '">' + attrObj.name + ' (' + _.escape(attrObj.typeName) + ')</option>';
}
});
if (options.length) {
- optgroup += '<optgroup label="' + obj.name + '">' + options + '</optgroup>';
+ optgroup += '<optgroup label="' + key + '">' + options + '</optgroup>';
}
}
});
@@ -266,7 +317,7 @@ define(['require',
trs = "";
_.each(this.model.attributes, function(val, key) {
if (key !== "__internal_UI_nameSpaceName" && key !== "isNew") {
- var td = '<td class="custom-col-1" data-key=' + key + '>' + key + '</td><td class="custom-col-0">:</td><td class="custom-col-1" data-id="value">' + that.getAttrElement({ namespace: that.model.get("__internal_UI_nameSpaceName"), key: key, val: val }) + '</td>';
+ var td = '<td class="custom-col-1" data-key=' + key + '>' + key + ' (' + _.escape(val.typeName) + ')</td><td class="custom-col-0">:</td><td class="custom-col-1" data-id="value">' + that.getAttrElement({ namespace: that.model.get("__internal_UI_nameSpaceName"), key: key, val: val }) + '</td>';
td += '<td class="custom-col-2 btn-group">' +
'<button class="btn btn-default btn-sm" data-key="' + key + '" data-id="deleteItem">' +
diff --git a/dashboardv3/public/js/views/entity/EntityNameSpaceView.js b/dashboardv3/public/js/views/entity/EntityNameSpaceView.js
index bbec0f7..645fc3e 100644
--- a/dashboardv3/public/js/views/entity/EntityNameSpaceView.js
+++ b/dashboardv3/public/js/views/entity/EntityNameSpaceView.js
@@ -62,39 +62,21 @@ define([
initialize: function(options) {
var that = this;
_.extend(this, _.pick(options, "entity", "nameSpaceCollection", "enumDefCollection", "guid", "fetchCollection"));
- this.editMode - false;
+ this.editMode = false;
this.$("editBox").hide();
- var nameSpaceSet = {};
- this.treeData = [];
this.actualCollection = new Backbone.Collection(
_.map(this.entity.namespaceAttributes, function(val, key) {
- var foundNameSpace = that.nameSpaceCollection.fullCollection.find({ name: key });
- var tempData = {
- text: key,
- name: key,
- parent: "#",
- icon: "fa fa-folder-o",
- children: []
- }
+ var foundNameSpace = that.nameSpaceCollection[key];
if (foundNameSpace) {
- var attributeDefs = foundNameSpace.get("attributeDefs");
_.each(val, function(aVal, aKey) {
- var foundAttr = _.find(attributeDefs, function(o) {
+ var foundAttr = _.find(foundNameSpace, function(o) {
return o.name === aKey
});
if (foundAttr) {
- var treVal = aKey + " : " + (foundAttr.typeName === "date" ? moment(aVal).format("MM/DD/YYYY") : aVal);
- tempData.children.push({
- text: treVal,
- name: treVal,
- icon: "fa fa-file-o",
- children: []
- })
val[aKey] = { value: aVal, typeName: foundAttr.typeName };
}
})
}
- that.treeData.push(tempData);
return _.extend({}, val, { __internal_UI_nameSpaceName: key });
}));
this.collection = new Backbone.Collection();
@@ -230,22 +212,38 @@ define([
var modelObj = { isNew: true };
this.collection.unshift(modelObj);
},
- generateTree: function() {
- this.ui.namespaceTree.jstree({
- plugins: ["core", "sort", "changed", "wholerow", "conditionalselect"],
- conditionalselect: function(node) {
- return false;
- },
- state: { opened: true, selected: false },
- core: {
- multiple: false,
- data: this.treeData
- }
- })
+ renderNamespace: function() {
+ var li = ""
+ this.actualCollection.forEach(function(obj) {
+ var attrLi = "";
+ _.each(obj.attributes, function(val, key) {
+ if (key !== "__internal_UI_nameSpaceName") {
+ var newVal = val;
+ if (_.isObject(val) && !_.isUndefinedNull(val.value)) {
+ newVal = val.value;
+ if (newVal.length > 0 && val.typeName.indexOf("date") > -1) {
+ newVal = _.map(newVal, function(dates) {
+ return moment(dates).format("MM/DD/YYYY");
+ });
+ }
+ if (val.typeName === "date") {
+ newVal = moment(newVal).format("MM/DD/YYYY");
+ }
+
+ }
+ attrLi += "<tr><td>" + _.escape(key) + " (" + _.escape(val.typeName) + ")</td><td>" + _.escape(newVal) + "</td></tr>";
+ }
+ });
+ li += "<ul class='namespace-tree-parent'><li class='table'>" + _.escape(obj.get("__internal_UI_nameSpaceName")) + "</li>" +
+ "<li class='namespace-tree-child entity-detail-table'>" +
+ "<table class='table'>" + attrLi + "</table>" +
+ "</li></ul>";
+ });
+ this.ui.namespaceTree.html(li);
},
onRender: function() {
this.panelOpenClose();
- this.generateTree();
+ this.renderNamespace();
}
});
});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js b/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js
index 16d6a6d..de1eedd 100644
--- a/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js
+++ b/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js
@@ -349,9 +349,7 @@ define(['require',
}
if (isMultiCheck) {
obj.multiValued = true;
- if (obj.typeName == "string" || obj.typeName == "int" || obj.typeName == "float") {
- obj.typeName = "array<" + obj.typeName + ">";
- }
+ obj.typeName = "array<" + obj.typeName + ">";
}
});
var notifyObj = {
@@ -489,9 +487,7 @@ define(['require',
}
if (isMultiCheck) {
obj.multiValued = true;
- if (obj.typeName == "string" || obj.typeName == "int" || obj.typeName == "float") {
- obj.typeName = "array<" + obj.typeName + ">";
- }
+ obj.typeName = "array<" + obj.typeName + ">";
}
});
diff --git a/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js b/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js
index bf8dd2e..2388ce3 100644
--- a/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js
+++ b/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js
@@ -70,6 +70,7 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
this.ui.enumCancleBtn.attr("disabled", "true");
};
events["click " + this.ui.enumOkBtn] = function(e) {
+ this.ui.enumCancleBtn.attr("disabled", "true");
this.onUpdateEnum();
};
return events;
@@ -173,6 +174,9 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
return;
}
this.ui.enumOkBtn.attr("disabled", "true");
+ this.ui.enumSelector.attr("disabled", "true");
+ this.ui.valueSelector.attr("disabled", "true");
+ this.ui.enumCancleBtn.attr("disabled", "true");
if (enumName) {
var enumDef = enumName.get("elementDefs");
if (enumDef.length === selectedEnumValues.length) {
@@ -231,6 +235,8 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
complete: function(model, status) {
that.emumTypeSelectDisplay();
that.ui.enumOkBtn.removeAttr("disabled");
+ that.ui.enumSelector.removeAttr("disabled");
+ that.ui.valueSelector.removeAttr("disabled");
if (that.options.closeModal) {
that.options.closeModal();
}
@@ -246,6 +252,8 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
content: "No updated values"
});
that.ui.enumOkBtn.removeAttr("disabled");
+ that.ui.enumSelector.removeAttr("disabled");
+ that.ui.valueSelector.removeAttr("disabled");
if (that.options.closeModal) {
that.options.closeModal();
}
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceAttrTableLayoutView.js b/dashboardv3/public/js/views/name_space/NameSpaceAttrTableLayoutView.js
index b5bdeb2..b60cc39 100644
--- a/dashboardv3/public/js/views/name_space/NameSpaceAttrTableLayoutView.js
+++ b/dashboardv3/public/js/views/name_space/NameSpaceAttrTableLayoutView.js
@@ -63,7 +63,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
- _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'nameSpaceAttr'));
+ _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'nameSpaceAttr', 'entityDefCollection'));
this.commonTableOptions = {
collection: this.nameSpaceAttr,
includeFilter: false,
@@ -141,6 +141,7 @@ define(['require',
that.renderTableLayoutView();
that.showDetails = true;
that.toggleNamespaceDetailsAttrView();
+ that.entityDefCollection.fetch({ silent: true });
},
parent: that.$el,
tagCollection: that.nameSpaceCollection,
@@ -189,7 +190,7 @@ define(['require',
})
},
typeName: {
- label: "typeName",
+ label: "Type Name",
cell: "html",
editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js b/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js
index ce99726..b537e41 100644
--- a/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js
+++ b/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js
@@ -57,9 +57,7 @@ define(['require',
this.model.set({ "name": e.target.value.trim() });
};
events["change " + this.ui.dataTypeSelector] = function(e) {
- //this.ui.multiValueSelect.hide();
if (e.target.value.trim() === 'enumeration' || e.target.value.trim() === 'Enumeration') {
- // this.model.set({ "typeName": "enum" });
this.ui.enumTypeSelectorContainer.show();
this.emumTypeSelectDisplay();
this.ui.stringLengthContainer.hide();
@@ -67,13 +65,9 @@ define(['require',
this.model.set({ "typeName": e.target.value.trim() });
this.model.set({ "enumValues": null });
this.ui.stringLengthContainer.show();
- //this.ui.multiValueSelect.show();
this.ui.enumTypeSelectorContainer.hide();
this.ui.enumValueSelectorContainer.hide();
} else {
- // if (e.target.value.trim() === 'int' || e.target.value.trim() === 'float') {
- // this.ui.multiValueSelect.show();
- // }
this.model.set({ "typeName": e.target.value.trim() });
this.model.set({ "enumValues": null });
this.ui.enumTypeSelectorContainer.hide();
@@ -101,9 +95,9 @@ define(['require',
events["change " + this.ui.enumValueSelector] = function(e) {
this.model.set({ "enumValues": this.ui.enumValueSelector.val() });
};
- // events["change " + this.ui.multiValueSelectStatus] = function(e) {
- // this.model.set({ "multiValueSelect": e.target.checked });
- // };
+ events["change " + this.ui.multiValueSelectStatus] = function(e) {
+ this.model.set({ "multiValueSelect": e.target.checked });
+ };
events["click " + this.ui.close] = 'onCloseButton';
events["click " + this.ui.createNewEnum] = 'onCreateUpdateEnum';
return events;
@@ -150,7 +144,7 @@ define(['require',
this.ui.attributeInput.attr("disabled", "false");
this.ui.dataTypeSelector.attr("disabled", "false");
this.ui.dataTypeSelector.attr("disabled", "false");
- //this.ui.multiValueSelect.hide();
+ this.ui.multiValueSelect.hide();
this.ui.dataTypeSelector.val(this.parentView.attrDetails.attrTypeName);
if (this.parentView.attrDetails.attrTypeName == "string") {
this.ui.stringLengthContainer.show();
@@ -176,11 +170,11 @@ define(['require',
this.ui.enumTypeSelector.val(typeName).trigger('change');
}
}
- // if (this.parentView.attrDetails.multiValued) {
- // this.ui.multiValueSelect.show();
- // $(this.ui.multiValueSelectStatus).prop('checked', true).trigger('change');
- // this.ui.multiValueSelectStatus.attr("disabled", "false");
- // }
+ if (this.parentView.attrDetails && this.parentView.attrDetails.multiValued) {
+ this.ui.multiValueSelect.show();
+ $(this.ui.multiValueSelectStatus).prop('checked', true).trigger('change');
+ this.ui.multiValueSelectStatus.attr("disabled", "false");
+ }
}
},
showEnumValues: function(enumName) {
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceContainerLayoutView.js b/dashboardv3/public/js/views/name_space/NameSpaceContainerLayoutView.js
index 481125d..a68715b 100644
--- a/dashboardv3/public/js/views/name_space/NameSpaceContainerLayoutView.js
+++ b/dashboardv3/public/js/views/name_space/NameSpaceContainerLayoutView.js
@@ -106,7 +106,8 @@ define([
guid: that.options.namespaceID,
typeHeaders: that.typeHeaders,
enumDefCollection: that.enumDefCollection,
- selectedNameSpace:that.selectedNameSpace
+ selectedNameSpace: that.selectedNameSpace,
+ entityDefCollection: that.options.entityDefCollection
}));
});
}
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js b/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js
index c852cf8..390542b 100644
--- a/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js
+++ b/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js
@@ -79,7 +79,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
- _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'nameSpaceAttr', 'selectedNameSpace'));
+ _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'entityDefCollection', 'nameSpaceAttr', 'selectedNameSpace'));
this.limit = 10;
this.offset = 0;
this.pervOld = [];
@@ -188,6 +188,7 @@ define(['require',
enumDefCollection.fetch({ reset: true });
that.showDetails = true;
that.toggleNamespaceDetailsAttrView();
+ that.entityDefCollection.fetch({ silent: true });
},
parent: that.$el,
tagCollection: that.nameSpaceCollection,
@@ -224,6 +225,7 @@ define(['require',
enumDefCollection.fetch({ reset: true });
that.showDetails = true;
that.toggleNamespaceDetailsAttrView();
+ that.entityDefCollection.fetch({ silent: true });
},
tagCollection: that.nameSpaceCollection,
enumDefCollection: enumDefCollection,
@@ -256,7 +258,7 @@ define(['require',
editable: false,
sortable: false,
cell: Backgrid.ExpandableCell,
- fixWidth: "50",
+ fixWidth: "20",
accordion: false,
alwaysVisible: true,
expand: function(el, model) {
@@ -298,7 +300,7 @@ define(['require',
editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
- return '<a title= "' + model.get('name') + '" href ="#!/administrator/namespace/' + model.get('guid') + '">' + model.get('name') + '</a>';
+ return '<a title= "' + model.get('name') + '" href ="#!/administrator/namespace/' + model.get('guid') + '?from=namespace">' + model.get('name') + '</a>';
}
})
},
diff --git a/dashboardv3/public/js/views/search/QueryBuilderView.js b/dashboardv3/public/js/views/search/QueryBuilderView.js
index 20179bf..c68087a 100644
--- a/dashboardv3/public/js/views/search/QueryBuilderView.js
+++ b/dashboardv3/public/js/views/search/QueryBuilderView.js
@@ -63,6 +63,7 @@ define(['require',
'classificationDefCollection',
'nameSpaceCollection',
'tag',
+ 'type',
'searchTableFilters',
'systemAttrArr'));
this.attrObj = _.sortBy(this.attrObj, 'name');
@@ -365,29 +366,28 @@ define(['require',
filters.push(returnObj);
}
});
- if (this.attrObj.length > 0) {
-
- var sortedNamespaceData = _.sortBy(this.nameSpaceCollection.models, function(obj) {
- return obj.get('name')
- });
- _.each(sortedNamespaceData, function(obj) {
- var namespaceName = obj.get('name');
-
- var sortedNamespaceAttr = _.sortBy(obj.attributes.attributeDefs, function(obj) {
- return obj.name;
- });
- _.each(sortedNamespaceAttr, function(attrDetails) {
- if (attrDetails.options && attrDetails.options.applicableEntityTypes && that.options.applicableType && (JSON.parse(attrDetails.options.applicableEntityTypes).indexOf(that.options.applicableType) != -1)) {
+ if (this.type) {
+ var entityDef = this.entityDefCollection.fullCollection.find({ name: that.options.applicableType }),
+ namespaceAttributeDefs = null;
+ if (entityDef) {
+ namespaceAttributeDefs = entityDef.get("namespaceAttributeDefs");
+ }
+ if (namespaceAttributeDefs) {
+ _.each(namespaceAttributeDefs, function(attributes, key) {
+ var sortedAttributes = _.sortBy(attributes, function(obj) {
+ return obj.name;
+ });
+ _.each(sortedAttributes, function(attrDetails) {
var returnObj = that.getObjDef(attrDetails, rules_widgets, isGroupView, 'Select Namespace Attribute', true);
if (returnObj) {
- returnObj.id = namespaceName + "." + returnObj.id;
- returnObj.label = namespaceName + ": " + returnObj.label;
+ returnObj.id = key + "." + returnObj.id;
+ returnObj.label = key + ": " + returnObj.label;
returnObj.data = { 'entityType': "namespace" };
filters.push(returnObj);
}
- }
- })
- });
+ });
+ });
+ }
}
filters = _.uniq(filters, 'id');
if (filters && !_.isEmpty(filters)) {
diff --git a/dashboardv3/public/js/views/search/SearchFilterBrowseLayoutView.js b/dashboardv3/public/js/views/search/SearchFilterBrowseLayoutView.js
index 4d5c5ce..b299140 100644
--- a/dashboardv3/public/js/views/search/SearchFilterBrowseLayoutView.js
+++ b/dashboardv3/public/js/views/search/SearchFilterBrowseLayoutView.js
@@ -133,7 +133,7 @@ define([
this.showDefaultPage();
},
showDefaultPage: function() {
- if (this.options.value) {
+ if (Utils.getUrlState.isSearchTab() && this.options.value) {
if (
!this.options.value.type &&
!this.options.value.tag &&
diff --git a/dashboardv3/public/js/views/search/SearchResultLayoutView.js b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
index 4cc5358..9854bd4 100644
--- a/dashboardv3/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
@@ -30,8 +30,9 @@ define(['require',
'utils/Messages',
'utils/Enums',
'utils/UrlLinks',
+ 'moment',
'platform'
-], function(require, Backbone, tableDragger, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages, Enums, UrlLinks, platform) {
+], function(require, Backbone, tableDragger, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages, Enums, UrlLinks, moment, platform) {
'use strict';
var SearchResultLayoutView = Backbone.Marionette.LayoutView.extend(
@@ -801,6 +802,20 @@ define(['require',
if (obj && obj.attributes) {
_.each(obj.attributes, function(namespaceValue, attributeName) {
if (attributeName.indexOf('.') != -1) {
+ var isDate = false,
+ namespace = that.options.nameSpaceCollection.fullCollection.find({ "name": attributeName.split('.')[0] });
+ if (namespace) {
+ var getAttributes = namespace.get('attributeDefs');
+ getAttributes.every(function(attrTypeCheck) {
+ if (attributeName.split('.')[1] === attrTypeCheck.name && attrTypeCheck.typeName.indexOf("date") > -1) {
+ isDate = true;
+ }
+ return !isDate;
+ });
+ }
+ if (isDate) {
+ namespaceValue = moment(namespaceValue).format("MM/DD/YYYY")
+ }
namespaceStr += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + attributeName + ': ' + namespaceValue + '</label>';
}
})
diff --git a/dashboardv3/public/js/views/search/tree/NameSpaceTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/NameSpaceTreeLayoutView.js
index f6477cf..c9afe7d 100644
--- a/dashboardv3/public/js/views/search/tree/NameSpaceTreeLayoutView.js
+++ b/dashboardv3/public/js/views/search/tree/NameSpaceTreeLayoutView.js
@@ -142,46 +142,25 @@ define([
this.ui.nameSpaceSearchTree.jstree(true).deselect_all();
this.namespaceID = null;
}
- // if (this.options.value === undefined) {
- // this.options.value = {};
- // }
- // if (!this.options.value.tag) {
- // this.ui.nameSpaceSearchTree.jstree(true).deselect_all();
- // this.nameSpaceId = null;
- // } else {
- // if (that.options.value.tag.indexOf("*") != -1) {
- // that.ui.nameSpaceSearchTree.jstree(true).deselect_all();
- // }
- // var dataFound = this.nameSpaceCollection.fullCollection.find(function(obj) {
- // return obj.get("name") === that.options.value.tag;
- // });
- // if (dataFound) {
- // if ((this.nameSpaceId && this.nameSpaceId !== dataFound.get("guid")) || this.nameSpaceId === null) {
- // if (this.nameSpaceId) {
- // this.ui.nameSpaceSearchTree.jstree(true).deselect_node(this.nameSpaceId);
- // }
- // this.fromManualRender = true;
- // this.nameSpaceId = dataFound.get("guid");
- // this.ui.nameSpaceSearchTree.jstree(true).select_node(dataFound.get("guid"));
- // }
- // }
- // if (!dataFound && Globals[that.options.value.tag]) {
- // this.fromManualRender = true;
- // this.typeId = Globals[that.options.value.tag].guid;
- // this.ui.nameSpaceSearchTree.jstree(true).select_node(this.typeId);
- // }
- // }
},
onNodeSelect: function(nodeData) {
var that = this,
options = nodeData.node.original,
- url = "#!/administrator/namespace";
+ url = "#!/administrator/namespace",
+ trigger = true,
+ queryParams = Utils.getUrlState.getQueryParams();
+
if (options.parent === undefined) {
url += "/" + options.id;
+ }
+
+ if (queryParams && queryParams.from === "namespace" && Utils.getUrlState.getQueryUrl().queyParams[0] === url) {
+ trigger = false;
+ }
+ if (trigger) {
this.triggerUrl(url);
- } else {
- //this.triggerSearch();
}
+
},
onViewEditNameSpace: function() {
var selectedNode = this.ui.nameSpaceSearchTree.jstree("get_selected", true);
@@ -194,16 +173,6 @@ define([
}
}
},
- // triggerSearch: function(params, url) {
- // var serachUrl = url ? url : "#!/search/searchResult";
- // Utils.setUrl({
- // url: serachUrl,
- // urlParams: params,
- // mergeBrowserUrl: false,
- // trigger: true,
- // updateTabState: true
- // });
- // },
triggerUrl: function(url) {
Utils.setUrl({
url: url,
@@ -252,32 +221,6 @@ define([
};
return nodeStructure;
};
- // getChildren = function(options) {
- // var children = options.children,
- // data = [],
- // dataWithoutEmptyTag = [],
- // isAttrNode = true;
- // if (children && children.length) {
- // _.each(children, function(attrDetail) {
- // var nodeDetails = {
- // name: _.escape(attrDetail.name),
- // model: attrDetail
- // },
- // nodeProperties = {
- // parent: options.parent,
- // text: _.escape(attrDetail.name),
- // model: attrDetail,
- // id: options.parent + "_" + _.escape(attrDetail.name)
- // },
- // getNodeDetails = generateNode(nodeDetails, isAttrNode),
- // classificationNode = _.extend(getNodeDetails, nodeProperties);
- // data.push(classificationNode);
- // });
- // } else {
- // return null;
- // }
- // return data;
- // };
_.each(namsSpaceTreeData, function(filterNode) {
nameSpaceList.push(generateNode(filterNode));
});
diff --git a/dashboardv3/public/js/views/site/Header.js b/dashboardv3/public/js/views/site/Header.js
index 1c771f6..06f1fe5 100644
--- a/dashboardv3/public/js/views/site/Header.js
+++ b/dashboardv3/public/js/views/site/Header.js
@@ -34,6 +34,7 @@ define(['require',
ui: {
backButton: "[data-id='backButton']",
menuHamburger: "[data-id='menuHamburger']",
+ administrator: "[data-id='administrator']",
signOut: "[data-id='signOut']"
},
events: function() {
@@ -52,6 +53,16 @@ define(['require',
var path = Utils.getBaseUrl(window.location.pathname);
window.location = path + "/logout.html";
};
+ events['click ' + this.ui.administrator] = function() {
+ Utils.setUrl({
+ url: "#!/administrator",
+ mergeBrowserUrl: false,
+ trigger: true,
+ updateTabState: true
+ });
+ };
+
+
return events;
},