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 2019/06/21 09:17:32 UTC

[atlas] branch master updated: ATLAS-3291 : UI: Don't allow user to sort on multiple value columns

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 37e441c  ATLAS-3291 : UI: Don't allow user to sort on multiple value columns
37e441c is described below

commit 37e441c11ba55b4c71650ade63d996334b3c8d37
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Thu Jun 20 16:25:22 2019 +0530

    ATLAS-3291 : UI: Don't allow user to sort on multiple value columns
---
 dashboardv2/public/css/scss/table.scss             |  7 ++++-
 .../js/views/search/SearchResultLayoutView.js      | 35 ++++++++++++++++++++--
 .../js/views/tag/TagDetailTableLayoutView.js       |  2 +-
 3 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/dashboardv2/public/css/scss/table.scss b/dashboardv2/public/css/scss/table.scss
index 7ce6b66..b712335 100644
--- a/dashboardv2/public/css/scss/table.scss
+++ b/dashboardv2/public/css/scss/table.scss
@@ -76,7 +76,7 @@ tr.empty {
 
     th.renderable.html-cell,
     td.renderable.html-cell {
-        max-width: 250px;
+        min-width: 250px;
     }
 
     .select-all-header-cell,
@@ -164,4 +164,9 @@ tr.empty {
             background: $color_jungle_green_light !important;
         }
     }
+}
+
+.toggleList.semi-collapsed div:nth-child(n+2) {
+    display: none;
+
 }
\ No newline at end of file
diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index f58f00f..6183b81 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -185,6 +185,7 @@ define(['require',
             },
             bindEvents: function() {
                 var that = this;
+                this.onClickLoadMore();
                 this.listenTo(this.searchCollection, 'backgrid:selected', function(model, checked) {
                     this.arr = [];
                     if (checked === true) {
@@ -263,7 +264,7 @@ define(['require',
                             saveState: false
                         },
                         visibilityControlOpts: {
-                            buttonTemplate: _.template("<button class='btn btn-action btn-sm pull-right'>Columns&nbsp<i class='fa fa-caret-down'></i></button>")
+                            buttonTemplate: _.template("<button class='btn btn-action btn-sm pull-right'>Attributes&nbsp<i class='fa fa-caret-down'></i></button>")
                         },
                         el: this.ui.colManager
                     },
@@ -761,7 +762,8 @@ define(['require',
                             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)
+                                    isRenderable = _.contains(columnToShow, key),
+                                    isSortable = obj.typeName.search(/(array|map)/i) == -1;
                                 if (key == "name" || key == "description" || key == "owner") {
                                     if (columnToShow) {
                                         col[key].renderable = isRenderable;
@@ -774,6 +776,7 @@ define(['require',
                                     editable: false,
                                     resizeable: true,
                                     orderable: true,
+                                    sortable: isSortable,
                                     renderable: isRenderable,
                                     formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                                         fromRaw: function(rawValue, model) {
@@ -786,7 +789,15 @@ define(['require',
                                                     'isTable': false
                                                 };
                                                 tempObj.valueObject[key] = modelObj.attributes[key];
-                                                return CommonViewFunction.propertyTable(tempObj);
+                                                var tablecolumn = CommonViewFunction.propertyTable(tempObj);
+                                                if (_.isArray(modelObj.attributes[key])) {
+                                                    var column = $("<div>" + tablecolumn + "</div>")
+                                                    if (tempObj.valueObject[key].length > 2) {
+                                                        column.addClass("toggleList semi-collapsed").append("<span><a data-id='load-more-columns'>Show More</a></span>");
+                                                    }
+                                                    return column;
+                                                }
+                                                return tablecolumn;
                                             }
                                         }
                                     })
@@ -797,6 +808,24 @@ define(['require',
                 }
                 return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
             },
+            onClickLoadMore: function() {
+                var that = this;
+                this.$el.on('click', "[data-id='load-more-columns']", function(event) {
+                    event.stopPropagation();
+                    event.stopImmediatePropagation();
+                    var $this = $(this),
+                        $toggleList = $(this).parents('.toggleList');
+                    if ($toggleList.length) {
+                        if ($toggleList.hasClass('semi-collapsed')) {
+                            $toggleList.removeClass('semi-collapsed');
+                            $this.text("Show Less");
+                        } else {
+                            $toggleList.addClass('semi-collapsed');
+                            $this.text("Show More");
+                        }
+                    }
+                });
+            },
             hideIrreleventElements: function() {
                 this.ui.rowData.siblings('.well').hide();
                 this.ui.rowData.siblings('.no-data').show();
diff --git a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js
index ed1312c..3f17d94 100644
--- a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js
@@ -87,6 +87,7 @@ define(['require',
                     includeFooterRecords: true,
                     includePageSize: true,
                     includeGotoPage: true,
+                    includeAtlasTableSorting: true,
                     gridOpts: {
                         className: "table table-hover backgrid table-quickMenu",
                         emptyText: 'No records found!'
@@ -119,7 +120,6 @@ define(['require',
                             label: "Classification",
                             cell: "html",
                             editable: false,
-                            sortable: false,
                             formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                                 fromRaw: function(rawValue, model) {
                                     if (that.guid !== model.get('entityGuid')) {