atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject atlas git commit: ATLAS-2111 : UI: Select query is not able to render the search table in Advance search
Date Fri, 29 Sep 2017 07:02:57 GMT
Repository: atlas
Updated Branches:
  refs/heads/master 5746ec9d0 -> f5508315a


ATLAS-2111 : UI: Select query is not able to render the search table in Advance search

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


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

Branch: refs/heads/master
Commit: f5508315a6b7758fd994eb0766fc11b89db2d715
Parents: 5746ec9
Author: kevalbhatt <kbhatt@apache.org>
Authored: Thu Sep 28 11:45:56 2017 +0530
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Fri Sep 29 00:02:50 2017 -0700

----------------------------------------------------------------------
 dashboardv2/public/js/collection/VSearchList.js |  12 +-
 .../js/views/search/SearchResultLayoutView.js   | 149 +++++++++++++------
 2 files changed, 113 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/f5508315/dashboardv2/public/js/collection/VSearchList.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/collection/VSearchList.js b/dashboardv2/public/js/collection/VSearchList.js
index 2005fe3..28c246f 100644
--- a/dashboardv2/public/js/collection/VSearchList.js
+++ b/dashboardv2/public/js/collection/VSearchList.js
@@ -39,16 +39,22 @@ define(['require',
                 this.queryText = resp.queryText;
                 this.referredEntities = resp.referredEntities;
                 if (resp.attributes) {
+                    this.dynamicTable = true;
                     var entities = [];
                     _.each(resp.attributes.values, function(obj) {
-                        var temp = { attributes: {} }
-                        _.each(obj, function(val, key) {
-                            temp.attributes[resp.attributes.name[key]] = val;
+                        var temp = {};
+                        _.each(obj, function(val, index) {
+                            var key = resp.attributes.name[index];
+                            if (key == "__guid") {
+                                key = "guid"
+                            }
+                            temp[key] = val;
                         });
                         entities.push(temp);
                     });
                     return entities;
                 } else {
+                    this.dynamicTable = false;
                     return resp.entities ? resp.entities : [];
                 }
             },

http://git-wip-us.apache.org/repos/asf/atlas/blob/f5508315/dashboardv2/public/js/views/search/SearchResultLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index fbcd352..e8151fd 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -525,7 +525,8 @@ define(['require',
                             return this;
                         }
                     });
-                    var columns = new columnCollection(that.getFixedDslColumn());
+                    that.bradCrumbList = [];
+                    var columns = new columnCollection((that.searchCollection.dynamicTable
? that.getDaynamicColumns(that.searchCollection.toJSON()) : that.getFixedDslColumn()));
                     columns.setPositions().sort();
                     that.REntityTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions,
{
                         columns: columns
@@ -679,7 +680,109 @@ define(['require',
                             }
                         })
                     };
+                    this.getTagTermCol({ 'col': col, 'columnToShow': columnToShow });
 
+                    if (this.value && this.value.searchType === "basic") {
+                        var def = this.entityDefCollection.fullCollection.find({ name: this.value.type
});
+                        if (def) {
+                            var attrObj = Utils.getNestedSuperTypeObj({ data: def.toJSON(),
collection: this.entityDefCollection, attrMerge: true });
+                            _.each(attrObj, function(obj, key) {
+                                var key = obj.name,
+                                    isRenderable = _.contains(columnToShow, key)
+                                if (key == "name" || key == "description" || key == "owner")
{
+                                    if (columnToShow) {
+                                        col[key].renderable = isRenderable;
+                                    }
+                                    return;
+                                }
+                                col[obj.name] = {
+                                    label: obj.name.capitalize(),
+                                    cell: "Html",
+                                    editable: false,
+                                    sortable: false,
+                                    resizeable: true,
+                                    orderable: true,
+                                    renderable: isRenderable,
+                                    formatter: _.extend({}, Backgrid.CellFormatter.prototype,
{
+                                        fromRaw: function(rawValue, model) {
+                                            var modelObj = model.toJSON();
+
+                                            if (modelObj && modelObj.attributes &&
!_.isUndefined(modelObj.attributes[key])) {
+                                                var tempObj = {
+                                                    'scope': that,
+                                                    'attributeDefs': [obj],
+                                                    'valueObject': {},
+                                                    'isTable': false
+                                                }
+
+                                                tempObj.valueObject[key] = modelObj.attributes[key]
+                                                Utils.findAndMergeRefEntity(tempObj.valueObject,
that.searchCollection.referredEntities);
+                                                return CommonViewFunction.propertyTable(tempObj);
+                                            }
+                                        }
+                                    })
+                                };
+                            });
+                        }
+                    }
+                }
+                return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
+            },
+            getDaynamicColumns: function(valueObj) {
+                var that = this,
+                    col = {};
+                if (valueObj && valueObj.length) {
+                    var firstObj = _.first(valueObj);
+                    _.each(_.keys(firstObj), function(key) {
+                        if (key !== 'guid') {
+                            col[key] = {
+                                label: key.capitalize(),
+                                cell: "Html",
+                                editable: false,
+                                sortable: false,
+                                resizeable: true,
+                                orderable: true,
+                                formatter: _.extend({}, Backgrid.CellFormatter.prototype,
{
+                                    fromRaw: function(rawValue, model) {
+                                        var modelObj = model.toJSON();
+                                        if (key == "name") {
+                                            var nameHtml = "",
+                                                name = modelObj[key];
+                                            if (modelObj.guid) {
+                                                nameHtml = '<a title="' + name + '" href="#!/detailPage/'
+ modelObj.guid + '">' + name + '</a>';
+                                            } else {
+                                                nameHtml = '<span title="' + name + '">'
+ name + '</span>';
+                                            }
+                                            if (modelObj.status && Enums.entityStateReadOnly[modelObj.status])
{
+                                                nameHtml += '<button type="button" title="Deleted"
class="btn btn-action btn-md deleteBtn"><i class="fa fa-trash"></i></button>';
+                                                return '<div class="readOnly readOnlyLink">'
+ nameHtml + '</div>';
+                                            }
+                                            return nameHtml;
+                                        } else if (modelObj && !_.isUndefined(modelObj[key]))
{
+                                            var tempObj = {
+                                                'scope': that,
+                                                // 'attributeDefs':
+                                                'valueObject': {},
+                                                'isTable': false
+                                            }
+
+                                            tempObj.valueObject[key] = modelObj[key]
+                                            Utils.findAndMergeRefEntity(tempObj.valueObject,
that.searchCollection.referredEntities);
+                                            return CommonViewFunction.propertyTable(tempObj);
+                                        }
+                                    }
+                                })
+                            };
+                        }
+                    });
+                }
+                return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
+            },
+            getTagTermCol: function(options) {
+                var that = this,
+                    columnToShow = options.columnToShow,
+                    col = options.col;
+                if (col) {
                     col['tag'] = {
                         label: "Tags",
                         cell: "Html",
@@ -727,51 +830,7 @@ define(['require',
                             })
                         };
                     }
-                    if (this.value && this.value.searchType === "basic") {
-                        var def = this.entityDefCollection.fullCollection.find({ name: this.value.type
});
-                        if (def) {
-                            var attrObj = Utils.getNestedSuperTypeObj({ data: def.toJSON(),
collection: this.entityDefCollection, attrMerge: true });
-                            _.each(attrObj, function(obj, key) {
-                                var key = obj.name,
-                                    isRenderable = _.contains(columnToShow, key)
-                                if (key == "name" || key == "description" || key == "owner")
{
-                                    if (columnToShow) {
-                                        col[key].renderable = isRenderable;
-                                    }
-                                    return;
-                                }
-                                col[obj.name] = {
-                                    label: obj.name.capitalize(),
-                                    cell: "Html",
-                                    editable: false,
-                                    sortable: false,
-                                    resizeable: true,
-                                    orderable: true,
-                                    renderable: isRenderable,
-                                    formatter: _.extend({}, Backgrid.CellFormatter.prototype,
{
-                                        fromRaw: function(rawValue, model) {
-                                            var modelObj = model.toJSON();
-
-                                            if (modelObj && modelObj.attributes &&
!_.isUndefined(modelObj.attributes[key])) {
-                                                var tempObj = {
-                                                    'scope': that,
-                                                    'attributeDefs': [obj],
-                                                    'valueObject': {},
-                                                    'isTable': false
-                                                }
-
-                                                tempObj.valueObject[key] = modelObj.attributes[key]
-                                                Utils.findAndMergeRefEntity(tempObj.valueObject,
that.searchCollection.referredEntities);
-                                                return CommonViewFunction.propertyTable(tempObj);
-                                            }
-                                        }
-                                    })
-                                };
-                            });
-                        }
-                    }
                 }
-                return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
             },
             addTagModalView: function(guid, multiple) {
                 var that = this;


Mime
View raw message