Commit 9dd0f5c6 by Keval Bhatt Committed by Suma Shivaprasad

ATLAS-725 : UI : Filter out or highlight deleted entities in search result…

ATLAS-725 : UI : Filter out or highlight deleted entities in search result outputs(dsl, text) , schema view, and lineage graph
parent c0cd9f0a
...@@ -188,3 +188,20 @@ button:focus { ...@@ -188,3 +188,20 @@ button:focus {
} }
} }
} }
.deleteBtn {
border-color: $color_mountain_mist_approx;
color: $color_mountain_mist_approx;
cursor: default;
margin: 10px;
&:hover {
border-color: $color_mountain_mist_approx;
color: $color_mountain_mist_approx;
background-color: $transparent;
}
&:focus {
border-color: $color_mountain_mist_approx;
color: $color_mountain_mist_approx;
background-color: $transparent;
}
}
...@@ -83,6 +83,7 @@ $color_mountain_mist_approx: #999; ...@@ -83,6 +83,7 @@ $color_mountain_mist_approx: #999;
$color_suva_gray_approx: #868686; $color_suva_gray_approx: #868686;
// $tag_color:#9599a0; // $tag_color:#9599a0;
$tag_color:#4A90E2; $tag_color:#4A90E2;
$delete_link:#BB5838;
//urls //urls
$url_0: url(../img/loading.gif); $url_0: url(../img/loading.gif);
.card { .card {
...@@ -238,3 +239,46 @@ ul { ...@@ -238,3 +239,46 @@ ul {
word-wrap: break-word; word-wrap: break-word;
} }
} }
.readOnly {
.addTag-dropdown {
display: none;
}
span {
&.inputTag[data-id="tagClick"] {
i.fa-close[data-id="deleteTag"] {
display: none;
}
}
}
&.readOnlyLink {
display: inline-block;
.deleteBtn {
padding: 0px 5px;
}
a {
color: $delete_link;
}
}
a {
&.inputTag[data-id="addTag"] {
display: none;
}
&.inputTag[data-id="tagClick"] {
i.fa-times[data-id="delete"] {
display: none;
}
}
i {
&.fa-trash[data-guid] {
display: none;
}
&.fa-trash[data-id="delete"] {
display: none;
}
}
&.inputAssignTag[data-id="addTerm"] {
display: none;
}
}
}
...@@ -41,6 +41,10 @@ define(['require'], function(require) { ...@@ -41,6 +41,10 @@ define(['require'], function(require) {
TAG_ADD: "Tag Added", TAG_ADD: "Tag Added",
TAG_DELETE: "Tag Deleted" TAG_DELETE: "Tag Deleted"
} }
Globals.entityStateReadOnly = {
ACTIVE: false,
DELETED: true
}
Globals.userLogedIn = { Globals.userLogedIn = {
status: false, status: false,
response: {} response: {}
......
...@@ -45,6 +45,8 @@ define(['require', 'backgrid', 'asBreadcrumbs'], function(require) { ...@@ -45,6 +45,8 @@ define(['require', 'backgrid', 'asBreadcrumbs'], function(require) {
Backgrid.Cell.prototype.initialize = function() { Backgrid.Cell.prototype.initialize = function() {
cellInit.apply(this, arguments); cellInit.apply(this, arguments);
var className = this.column.get('className'); var className = this.column.get('className');
var rowClassName = this.column.get('rowClassName');
if (rowClassName) this.$el.addClass(rowClassName);
if (className) this.$el.addClass(className); if (className) this.$el.addClass(className);
} }
/* /*
......
...@@ -117,9 +117,16 @@ define(['require', ...@@ -117,9 +117,16 @@ define(['require',
bindEvents: function() { bindEvents: function() {
var that = this; var that = this;
this.listenTo(this.collection, 'reset', function() { this.listenTo(this.collection, 'reset', function() {
var collectionJSON = this.collection.toJSON(); var collectionJSON = this.collection.toJSON();
if (collectionJSON[0].id && collectionJSON[0].id.id) { if (collectionJSON[0].id && collectionJSON[0].id.id) {
var tagGuid = collectionJSON[0].id.id; var tagGuid = collectionJSON[0].id.id;
this.readOnly = Globals.entityStateReadOnly[collectionJSON[0].id.state];
}
if (this.readOnly) {
this.$el.addClass('readOnly');
} else {
this.$el.removeClass('readOnly');
} }
if (collectionJSON && collectionJSON.length) { if (collectionJSON && collectionJSON.length) {
if (collectionJSON[0].values) { if (collectionJSON[0].values) {
...@@ -127,7 +134,11 @@ define(['require', ...@@ -127,7 +134,11 @@ define(['require',
this.description = collectionJSON[0].values.description; this.description = collectionJSON[0].values.description;
if (this.name) { if (this.name) {
this.ui.title.show(); this.ui.title.show();
this.ui.title.html('<span>' + this.name + '</span>'); var titleName = '<span>' + this.name + '</span>';
if (this.readOnly) {
titleName += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i> Deleted</button>'
}
this.ui.title.html(titleName);
} else { } else {
this.ui.title.hide(); this.ui.title.hide();
} }
......
...@@ -23,8 +23,9 @@ define(['require', ...@@ -23,8 +23,9 @@ define(['require',
'models/VEntity', 'models/VEntity',
'utils/Utils', 'utils/Utils',
'dagreD3', 'dagreD3',
'd3-tip' 'd3-tip',
], function(require, Backbone, LineageLayoutViewtmpl, VLineageList, VEntity, Utils, dagreD3, d3Tip) { 'utils/Globals'
], function(require, Backbone, LineageLayoutViewtmpl, VLineageList, VEntity, Utils, dagreD3, d3Tip, Globals) {
'use strict'; 'use strict';
var LineageLayoutView = Backbone.Marionette.LayoutView.extend( var LineageLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -110,19 +111,24 @@ define(['require', ...@@ -110,19 +111,24 @@ define(['require',
function addValueInObject(data) { function addValueInObject(data) {
var obj = {}; var obj = {};
if (data && data.definition && data.definition.values) { if (data && data.definition) {
var values = data.definition.values; if (data.definition.values) {
obj['label'] = values.name.trunc(20); var values = data.definition.values;
obj['toolTiplabel'] = values.name; obj['label'] = values.name.trunc(20);
obj['id'] = data.GUID; obj['toolTiplabel'] = values.name;
if (values.queryText) { obj['id'] = data.GUID;
obj['queryText'] = values.queryText; if (values.queryText) {
obj['queryText'] = values.queryText;
}
if (data.definition.id && data.definition.id.state) {
obj['state'] = data.definition.id.state;
}
} }
obj['shape'] = "img";
} else { } else {
obj['label'] = vertices[val].values.name; obj['label'] = ""
obj['toolTiplabel'] = values.name; obj['toolTiplabel'] = "";
} }
obj['shape'] = "img";
obj['class'] = "type-TOP"; obj['class'] = "type-TOP";
if (data.GUID) { if (data.GUID) {
that.g.setNode(data.GUID, obj); that.g.setNode(data.GUID, obj);
...@@ -177,6 +183,11 @@ define(['require', ...@@ -177,6 +183,11 @@ define(['require',
obj['class'] = "type-TOP"; obj['class'] = "type-TOP";
obj['shape'] = "img"; obj['shape'] = "img";
obj['typeName'] = vertices[val].values.vertexId.values.typeName; obj['typeName'] = vertices[val].values.vertexId.values.typeName;
if (vertices[val].values.state) {
obj['state'] = vertices[val].values.state;
} else if (vertices[val].values.vertexId.values.state) {
obj['state'] = vertices[val].values.vertexId.values.state;
}
if (val && obj) { if (val && obj) {
that.g.setNode(val, obj); that.g.setNode(val, obj);
} }
...@@ -283,13 +294,17 @@ define(['require', ...@@ -283,13 +294,17 @@ define(['require',
.attr("xlink:href", function(d) { .attr("xlink:href", function(d) {
if (node) { if (node) {
if (node.typeName) { if (node.typeName) {
if (node.id == that.guid) { if (Globals.entityStateReadOnly[node.state]) {
return '../img/icon-table-delete.png';
} else if (node.id == that.guid) {
return '../img/icon-table-active.png'; return '../img/icon-table-active.png';
} else { } else {
return '../img/icon-table.png'; return '../img/icon-table.png';
} }
} else { } else {
if (node.id == that.guid) { if (Globals.entityStateReadOnly[node.state]) {
return '../img/icon-gear-delete.png';
} else if (node.id == that.guid) {
return '../img/icon-gear-active.png'; return '../img/icon-gear-active.png';
} else { } else {
return '../img/icon-gear.png'; return '../img/icon-gear.png';
......
...@@ -289,10 +289,17 @@ define(['require', ...@@ -289,10 +289,17 @@ define(['require',
return new Date(rawValue); return new Date(rawValue);
} }
if (model.get('name') == rawValue) { if (model.get('name') == rawValue) {
var nameHtml = "";
if (model.get('$id$')) { if (model.get('$id$')) {
return '<a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a>'; nameHtml = '<a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a>';
} else { } else {
return '<a>' + rawValue + '</a>'; nameHtml = '<a>' + rawValue + '</a>';
}
if (Globals.entityStateReadOnly[model.get('$id$').state]) {
nameHtml += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
} else {
return nameHtml;
} }
} else { } else {
return rawValue; return rawValue;
...@@ -313,7 +320,12 @@ define(['require', ...@@ -313,7 +320,12 @@ define(['require',
className: 'searchTag', className: 'searchTag',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
return CommonViewFunction.tagForTable(model); if (Globals.entityStateReadOnly[model.get('$id$').state]) {
return '<div class="readOnly">' + CommonViewFunction.tagForTable(model); + '</div>';
} else {
return CommonViewFunction.tagForTable(model);
}
} }
}) })
}; };
...@@ -330,7 +342,11 @@ define(['require', ...@@ -330,7 +342,11 @@ define(['require',
if (returnObject.object) { if (returnObject.object) {
that.bradCrumbList.push(returnObject.object); that.bradCrumbList.push(returnObject.object);
} }
return returnObject.html; if (Globals.entityStateReadOnly[model.get('$id$').state]) {
return '<div class="readOnly">' + returnObject.html + '</div>';
} else {
return returnObject.html;
}
} }
}) })
}; };
...@@ -375,10 +391,18 @@ define(['require', ...@@ -375,10 +391,18 @@ define(['require',
model.getEntity(guid, { model.getEntity(guid, {
beforeSend: function() {}, beforeSend: function() {},
success: function(data) { success: function(data) {
if (data.definition && data.definition.values && data.definition.values.name) { if (data.definition) {
return that.$('td a[data-id="' + guid + '"]').html(data.definition.values.name); if (data.definition.id && data.definition.id.state) {
} else { if (Globals.entityStateReadOnly[data.definition.id.state]) {
return that.$('td a[data-id="' + guid + '"]').html(data.definition.id.id); that.$('td a[data-id="' + guid + '"]').parent().addClass('readOnly readOnlyLink');
that.$('td a[data-id="' + guid + '"]').parent().append('<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>');
}
}
if (data.definition.values && data.definition.values.name) {
return that.$('td a[data-id="' + guid + '"]').html(data.definition.values.name);
} else {
return that.$('td a[data-id="' + guid + '"]').html(data.definition.id.id);
}
} }
}, },
error: function(error, data, status) {}, error: function(error, data, status) {},
...@@ -387,17 +411,25 @@ define(['require', ...@@ -387,17 +411,25 @@ define(['require',
that.checkTableFetch(); that.checkTableFetch();
} }
}); });
return '<a href="#!/detailPage/' + guid + '" data-id="' + guid + '"></a>'; return '<div><a href="#!/detailPage/' + guid + '" data-id="' + guid + '"></a></div>';
} else if (!modelObject.$typeName$) { } else if (!modelObject.$typeName$) {
var guid = model.toJSON().guid; var guid = model.toJSON().guid;
++that.fetchList; ++that.fetchList;
model.getEntity(guid, { model.getEntity(guid, {
beforeSend: function() {}, beforeSend: function() {},
success: function(data) { success: function(data) {
if (data.definition && data.definition.values && data.definition.values.name) { if (data.definition) {
return that.$('td a[data-id="' + guid + '"]').html(data.definition.values.name); if (data.definition.id && data.definition.id.state) {
} else { if (Globals.entityStateReadOnly[data.definition.id.state]) {
return that.$('td a[data-id="' + guid + '"]').html(data.definition.id.id); that.$('td a[data-id="' + guid + '"]').parent().addClass('readOnly readOnlyLink');
that.$('td a[data-id="' + guid + '"]').parent().append('<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>');
}
}
if (data.definition.values && data.definition.values.name) {
return that.$('td a[data-id="' + guid + '"]').html(data.definition.values.name);
} else {
return that.$('td a[data-id="' + guid + '"]').html(data.definition.id.id);
}
} }
}, },
error: function(error, data, status) {}, error: function(error, data, status) {},
...@@ -406,7 +438,7 @@ define(['require', ...@@ -406,7 +438,7 @@ define(['require',
that.checkTableFetch(); that.checkTableFetch();
} }
}); });
return '<a href="#!/detailPage/' + guid + '" data-id="' + guid + '"></a>'; return '<div><a href="#!/detailPage/' + guid + '" data-id="' + guid + '"></a></div>';
} }
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment