From 770b82746fafcc4455eb52db3e0cdc4f2ff8236d Mon Sep 17 00:00:00 2001 From: gutkaBinit <binitgutka@gmail.com> Date: Fri, 15 Mar 2019 16:01:32 +0530 Subject: [PATCH] ATLAS-3076 UI : Relationship Tab improvements. Signed-off-by: nixonrodrigues <nixon@apache.org> --- dashboardv2/public/js/templates/graph/RelationshipLayoutView_tmpl.html | 14 +++++++------- dashboardv2/public/js/utils/CommonViewFunction.js | 4 +++- dashboardv2/public/js/views/graph/RelationshipLayoutView.js | 13 +++++++------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/dashboardv2/public/js/templates/graph/RelationshipLayoutView_tmpl.html b/dashboardv2/public/js/templates/graph/RelationshipLayoutView_tmpl.html index ff43907..9df75b5 100644 --- a/dashboardv2/public/js/templates/graph/RelationshipLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/graph/RelationshipLayoutView_tmpl.html @@ -19,7 +19,7 @@ <div class="btn-group pull-left"> <span class="pull-left">Graph</span> <label class="switch pull-left"> - <input type="checkbox" class="switch-input" name="relationshipViewToggle" value="text"> + <input type="checkbox" checked class="switch-input" name="relationshipViewToggle" value="text"> <span class="switch-slider"></span> </label> <span class="pull-left">Table</span> @@ -29,21 +29,21 @@ <button type="button" id="zoom_out" class="btn btn-action btn-gray btn-sm lineageZoomButton" title="Zoom Out" data-id="refreshBtn"> <i class="fa fa-search-minus"></i></button> </div> </div> -<div class="white-bg no-padding relationship-box" data-id='relationshipSVG'> +<div class="white-bg no-padding relationship-box invisible" data-id='relationshipSVG'> <div class="fontLoader"> <i class="fa fa-refresh fa-spin-custom"></i> </div> <svg width="100%" height="100%" viewBox="0 0 854 330" enable-background="new 0 0 854 330" xml:space="preserve"></svg> - <div class="box-panel size-lg slide-from-left relationship-node-details"> + <div class="box-panel size-lg slide-from-left relationship-node-details"> <div class="header clearfix"> <h4><span data-id="typeName"></span></h4> <span data-id="box-close" class="btn btn-sm btn-close"><i class="fa fa-close"></i></span> </div> <div class="body"> <div class="col-md-12"> - <input data-id="searchNode" class="form-control form-group" placeholder="Search Entities" /> - <ul data-id="entityList" class="entity-list"></ul> - </div> + <input data-id="searchNode" class="form-control form-group" placeholder="Search Entities" /> + <ul data-id="entityList" class="entity-list"></ul> + </div> </div> </div> <!-- <div class="relationship-details"> @@ -56,7 +56,7 @@ </div> --> </div> <div> - <table class="table table-quickMenu" data-id="relationshipDetailTable" style="display: none;"> + <table class="table table-quickMenu" data-id="relationshipDetailTable"> <thead> <tr> <th>Key</th> diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index 2c0fbaf..2aa825a 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -227,6 +227,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob return; } var keyValue = valueObject[key]; + var count = _.isArray(keyValue) ? (keyValue.length) : 0; var defEntity = _.find(attributeDefs, { name: key }); if (defEntity && defEntity.typeName) { var defEntityType = defEntity.typeName.toLocaleLowerCase(); @@ -263,7 +264,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob htmlTag = '<pre class="shrink code-block ' + (isMatchJSONStringIsSingle ? 'fixed-height' : '') + '">' + expandCollapseButton + '<code>' + val + '</code></pre>'; } } - table += '<tr><td>' + _.escape(key) + '</td><td>' + htmlTag + '</td></tr>'; + var textToDisplay = count > 0 ? ' (' + getValue(count) + ')' : ''; + table += '<tr><td>' + _.escape(key) + textToDisplay + '</td><td>' + htmlTag + '</td></tr>'; } else { table += '<div>' + val + '</div>'; } diff --git a/dashboardv2/public/js/views/graph/RelationshipLayoutView.js b/dashboardv2/public/js/views/graph/RelationshipLayoutView.js index aba3a41..8fec580 100644 --- a/dashboardv2/public/js/views/graph/RelationshipLayoutView.js +++ b/dashboardv2/public/js/views/graph/RelationshipLayoutView.js @@ -95,7 +95,9 @@ define(['require', } return { nodes: nodes, links: links }; }, - onRender: function() {}, + onRender: function() { + this.$el.addClass('auto-height'); + }, onShow: function(argument) { if (this.graphData && _.isEmpty(this.graphData.links)) { this.noRelationship(); @@ -458,18 +460,17 @@ define(['require', }, createTable: function() { this.entityModel = new VEntity({}); - var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.relationshipAttributes, attributeDefs: this.attributeDefs }); + var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.relationshipAttributes, attributeDefs: this.attributeDefs, numberFormat: _.numberFormatWithComa }); this.ui.relationshipDetailValue.html(table); }, relationshipViewToggle: function(checked) { + this.ui.relationshipDetailTable.toggleClass('visible invisible'); + this.ui.relationshipSVG.toggleClass('visible invisible'); + if (checked) { - this.ui.relationshipDetailTable.show(); - this.ui.relationshipSVG.hide(); this.ui.zoomControl.hide(); this.$el.addClass('auto-height'); } else { - this.ui.relationshipDetailTable.hide(); - this.ui.relationshipSVG.show(); this.ui.zoomControl.show(); this.$el.removeClass('auto-height'); } -- libgit2 0.27.1