Repository: incubator-atlas Updated Branches: refs/heads/master 69c4806ac -> c7900f255
ATLAS-1592: updated UI to display struct values without type header details Signed-off-by: Madhan Neethiraj <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/c7900f25 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/c7900f25 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/c7900f25 Branch: refs/heads/master Commit: c7900f25540ad5b522e5d3eb1c93a14cbce578d1 Parents: 69c4806 Author: kevalbhatt <[email protected]> Authored: Fri Feb 24 15:07:51 2017 +0530 Committer: Madhan Neethiraj <[email protected]> Committed: Fri Feb 24 09:54:16 2017 -0800 ---------------------------------------------------------------------- .../public/js/utils/CommonViewFunction.js | 11 +++++++++-- .../views/detail_page/DetailPageLayoutView.js | 1 + .../js/views/entity/CreateEntityLayoutView.js | 20 +++++++++++++++----- .../views/entity/EntityDetailTableLayoutView.js | 2 +- .../public/js/views/tag/TagLayoutView.js | 2 -- 5 files changed, 26 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c7900f25/dashboardv2/public/js/utils/CommonViewFunction.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index 4f90168..6183e54 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -149,7 +149,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum valueOfArray.push('<span>' + _.escape(inputOutputField) + '</span>'); } } else if (_.isObject(inputOutputField) && !id) { - _.each(inputOutputField, function(objValue, objKey) { + var attributesList = inputOutputField; + if (scope.typeHeaders && inputOutputField.typeName) { + var typeNameCategory = scope.typeHeaders.fullCollection.findWhere({ name: inputOutputField.typeName }); + if (attributesList.attributes && typeNameCategory && typeNameCategory.get('category') === 'STRUCT') { + attributesList = attributesList.attributes; + } + } + _.each(attributesList, function(objValue, objKey) { var value = objValue; if (objKey.indexOf("$") == -1) { if (_.isObject(value)) { @@ -162,7 +169,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum if (id && inputOutputField) { var name = Utils.getName(inputOutputField); - if (name === "-") { + if (name === "-" || name === id) { var fetch = true; var fetchId = (_.isObject(id) ? id.id : id); fetchInputOutputValue(fetchId); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c7900f25/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js index bba2e79..41be98d 100644 --- a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js +++ b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js @@ -167,6 +167,7 @@ define(['require', referredEntities: this.entityObject.referredEntities, guid: this.id, entityName: this.name, + typeHeaders: this.typeHeaders, entityDefCollection: this.entityDefCollection, fetchCollection: this.fetchCollection.bind(that) } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c7900f25/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js index 64916e5..d6711aa 100644 --- a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js +++ b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js @@ -148,7 +148,7 @@ define(['require', this.decrementCounter('asyncFetchLOVCounter'); this.addJsonSearchData(); }, this); - this.ui.entityInputData.on("keyup", "textarea", function() { + this.ui.entityInputData.on("keyup change", "textarea", function(e) { var value = this.value; if (!value.length && $(this).hasClass('false')) { $(this).removeClass('errorClass'); @@ -165,7 +165,6 @@ define(['require', that.modal.$el.find('button.ok').prop("disabled", true); } } - }); if (this.guid) { @@ -433,12 +432,23 @@ define(['require', } }, - getTextArea: function(value, entityValue) { + getTextArea: function(value, entityValue, structType) { + var setValue = entityValue + try { + if (structType && entityValue && entityValue.length) { + var parseValue = JSON.parse(entityValue); + if (_.isObject(parseValue) && !_.isArray(parseValue) && parseValue.attributes) { + setValue = JSON.stringify(parseValue.attributes); + } + } + } catch (err) {} + return '<textarea class="form-control entityInputBox ' + (value.isOptional === true ? "false" : "true") + '"' + ' data-type="' + value.typeName + '"' + ' data-key="' + value.name + '"' + ' placeholder="' + value.name + '"' + - ' data-id="entityInput">' + entityValue + '</textarea>'; + ' data-id="entityInput">' + setValue + '</textarea>'; + }, getInput: function(value, entityValue) { return '<input class="form-control entityInputBox ' + (value.isOptional === true ? "false" : "true") + '"' + @@ -491,7 +501,7 @@ define(['require', } else { var typeNameCategory = this.typeHeaders.fullCollection.findWhere({ name: typeName }); if (typeNameCategory && typeNameCategory.get('category') === 'STRUCT') { - return this.getTextArea(value, entityValue); + return this.getTextArea(value, entityValue, true); } else { return this.getInput(value, entityValue); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c7900f25/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js b/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js index a9f7e29..651c1ce 100644 --- a/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js +++ b/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js @@ -48,7 +48,7 @@ define(['require', * @constructs */ initialize: function(options) { - _.extend(this, _.pick(options, 'entity', 'referredEntities')); + _.extend(this, _.pick(options, 'entity', 'referredEntities', 'typeHeaders')); this.entityModel = new VEntity({}); }, bindEvents: function() {}, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c7900f25/dashboardv2/public/js/views/tag/TagLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js index 4b2f5e7..13ea0f4 100644 --- a/dashboardv2/public/js/views/tag/TagLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagLayoutView.js @@ -242,8 +242,6 @@ define(['require', classificationDefs: [{ 'name': this.name.trim(), 'description': this.description.trim(), - "typeVersion": "2", - "version": "2", 'superTypes': superTypes.length ? superTypes : [], "attributeDefs": attributeObj }],
