You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ni...@apache.org on 2017/05/10 14:02:53 UTC
[2/2] incubator-atlas git commit: ATLAS-1759 : UI - Add checkbox to
exclude deleted entities in schema table.
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/7882ec26
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/7882ec26
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/7882ec26
Branch: refs/heads/0.8-incubating
Commit: 7882ec26783200016af39fcda551087bf96d4508
Parents: 156f04f
Author: Kalyani <ka...@freestoneinfotech.com>
Authored: Wed May 3 18:36:55 2017 +0530
Committer: nixonrodrigues <ni...@apache.org>
Committed: Wed May 10 19:32:01 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/7882ec26/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 @@
-->
<div>
<div class="tableOverlay"></div>
+ <div style="margin-left: 20px" data-id="checkDeletedEntity">
+ <label class="checkbox">
+ <input type="checkbox" class="input" name="queryType" value="text" name="check" value="1" />Include historical entities</label>
+ </div>
<div class="clearfix">
<a href="javascript:void(0)" class="inputAssignTag multiSelectTerm btnAssign" style="display:none" data-id="addTerm"><i class="fa fa-folder-o"></i> Assign Term</a>
<a href="javascript:void(0)" class="inputAssignTag multiSelectTag assignTag btnAssign" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i> Assign Tag</a>
</div>
- <div id="r_schemaTableLayoutView"></div>
+ <div id="r_schemaTableLayoutView">
+ </div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/7882ec26/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 = '<a href="#!/detailPage/' + model.get('guid') + '">' + value + '</a>';
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;