Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DCC56200C73 for ; Wed, 10 May 2017 16:02:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DB28E160BA8; Wed, 10 May 2017 14:02:59 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0549F160B9C for ; Wed, 10 May 2017 16:02:58 +0200 (CEST) Received: (qmail 67989 invoked by uid 500); 10 May 2017 14:02:57 -0000 Mailing-List: contact commits-help@atlas.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.incubator.apache.org Delivered-To: mailing list commits@atlas.incubator.apache.org Received: (qmail 67980 invoked by uid 99); 10 May 2017 14:02:57 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2017 14:02:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 015541AFA0A for ; Wed, 10 May 2017 14:02:57 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.221 X-Spam-Level: X-Spam-Status: No, score=-4.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id OmbIE6EUQVlX for ; Wed, 10 May 2017 14:02:55 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id E22AF5F567 for ; Wed, 10 May 2017 14:02:53 +0000 (UTC) Received: (qmail 67881 invoked by uid 99); 10 May 2017 14:02:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2017 14:02:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 02DD5DFDD5; Wed, 10 May 2017 14:02:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nixon@apache.org To: commits@atlas.incubator.apache.org Date: Wed, 10 May 2017 14:02:52 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-atlas git commit: ATLAS-1759 : UI - Add checkbox to exclude deleted entities in schema table. archived-at: Wed, 10 May 2017 14:03:00 -0000 Repository: incubator-atlas Updated Branches: refs/heads/0.8-incubating 156f04f97 -> 7882ec267 refs/heads/master 96d9a0ec2 -> 1decc7316 ATLAS-1759 : UI - Add checkbox to exclude deleted entities in schema table. Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/1decc731 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/1decc731 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/1decc731 Branch: refs/heads/master Commit: 1decc731684ca6f2eb72d7f7c9cc3aa223f7a957 Parents: 96d9a0e Author: Kalyani Authored: Wed May 3 18:36:55 2017 +0530 Committer: nixonrodrigues Committed: Wed May 10 19:27:17 2017 +0530 ---------------------------------------------------------------------- .../schema/SchemaTableLayoutView_tmpl.html | 7 +- .../public/js/views/schema/SchemaLayoutView.js | 73 +++++++++++++++----- 2 files changed, 60 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1decc731/dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html b/dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html index c133d1f..21300b2 100644 --- a/dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html @@ -16,9 +16,14 @@ -->
+
+ +
-
+
+
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1decc731/dashboardv2/public/js/views/schema/SchemaLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/schema/SchemaLayoutView.js b/dashboardv2/public/js/views/schema/SchemaLayoutView.js index 75714f0..e7f0f6e 100644 --- a/dashboardv2/public/js/views/schema/SchemaLayoutView.js +++ b/dashboardv2/public/js/views/schema/SchemaLayoutView.js @@ -47,7 +47,9 @@ define(['require', addTerm: '[data-id="addTerm"]', showMoreLess: '[data-id="showMoreLess"]', showMoreLessTerm: '[data-id="showMoreLessTerm"]', - addAssignTag: "[data-id='addAssignTag']" + addAssignTag: "[data-id='addAssignTag']", + checkDeletedEntity: "[data-id='checkDeletedEntity']", + }, /** ui events hash */ events: function() { @@ -84,6 +86,8 @@ define(['require', $(e.currentTarget).find('span').text('Show less'); } }; + events["click " + this.ui.checkDeletedEntity] = 'onCheckDeletedEntity'; + return events; }, /** @@ -142,20 +146,36 @@ define(['require', }); }, onRender: function() { - var that = this; - _.each(this.attribute, function(obj) { - var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName }); + this.generateTableData(); + }, + generateTableData: function(checkedDelete) { + var that = this, + newModel; + this.activeObj = []; + this.deleteObj = []; + this.schemaTableAttribute = null; + if (this.attribute && this.attribute[0]) { + var firstColumn = this.attribute[0], + defObj = that.entityDefCollection.fullCollection.find({ name: firstColumn.typeName }); if (defObj && defObj.get('options') && defObj.get('options').schemaAttributes) { - try { - var mapObj = JSON.parse(defObj.get('options').schemaAttributes); - var newModel = that.referredEntities[obj.guid]; - newModel.schemaTableAttribute = _.pick(newModel.attributes, mapObj); - if (newModel.attributes['position']) { - newModel['position'] = newModel.attributes['position']; - } - - that.schemaCollection.push(newModel); - } catch (e) {} + if (firstColumn) { + try { + var mapObj = JSON.parse(defObj.get('options').schemaAttributes); + that.schemaTableAttribute = _.pick(firstColumn.attributes, mapObj); + } catch (e) {} + } + } + } + _.each(this.attribute, function(obj) { + newModel = that.referredEntities[obj.guid]; + if (newModel.attributes['position']) { + newModel['position'] = newModel.attributes['position']; + } + if (!Enums.entityStateReadOnly[newModel.status]) { + that.activeObj.push(newModel); + that.schemaCollection.push(newModel); + } else if (Enums.entityStateReadOnly[newModel.status]) { + that.deleteObj.push(newModel); } }); $('body').click(function(e) { @@ -167,6 +187,13 @@ define(['require', that.$('.popover.popoverTag').hide(); } }); + if (this.schemaCollection.length === 0 && this.deleteObj.length) { + this.ui.checkDeletedEntity.find("input").prop('checked', true); + this.schemaCollection.reset(this.deleteObj, { silent: true }); + } + if (this.activeObj.length === 0 && this.deleteObj.length === 0) { + this.ui.checkDeletedEntity.hide(); + } this.renderTableLayoutView(); }, showLoader: function() { @@ -177,7 +204,7 @@ define(['require', this.$('.fontLoader').hide(); this.$('.tableOverlay').hide(); }, - renderTableLayoutView: function() { + renderTableLayoutView: function(deleteEnity) { var that = this; require(['utils/TableLayout'], function(TableLayout) { var columnCollection = Backgrid.Columns.extend({ @@ -222,7 +249,6 @@ define(['require', }, getSchemaTableColumns: function() { var that = this, - schemaFirstmodel = this.schemaCollection.first(), col = { Check: { name: "selected", @@ -231,8 +257,8 @@ define(['require', headerCell: "select-all" } } - if (schemaFirstmodel) { - _.each(_.keys(schemaFirstmodel.get('schemaTableAttribute')), function(key) { + if (this.schemaTableAttribute) { + _.each(_.keys(this.schemaTableAttribute), function(key) { if (key !== "position") { col[key] = { label: key, @@ -242,7 +268,7 @@ define(['require', className: "searchTableName", formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { - var value = model.get('schemaTableAttribute')[key]; + var value = model.get('attributes')[key]; if (key === "name" && model.get('guid')) { var nameHtml = '' + value + ''; if (model.get('status') && Enums.entityStateReadOnly[model.get('status')]) { @@ -410,6 +436,15 @@ define(['require', that.fetchCollection(); } }); + }, + onCheckDeletedEntity: function(e) { + if (e.target.checked) { + if (this.deleteObj.length) { + this.schemaCollection.reset(this.activeObj.concat(this.deleteObj)); + } + } else { + this.schemaCollection.reset(this.activeObj); + } } }); return SchemaTableLayoutView;