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 {
}
}
}
.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;
$color_suva_gray_approx: #868686;
// $tag_color:#9599a0;
$tag_color:#4A90E2;
$delete_link:#BB5838;
//urls
$url_0: url(../img/loading.gif);
.card {
......@@ -238,3 +239,46 @@ ul {
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) {
TAG_ADD: "Tag Added",
TAG_DELETE: "Tag Deleted"
}
Globals.entityStateReadOnly = {
ACTIVE: false,
DELETED: true
}
Globals.userLogedIn = {
status: false,
response: {}
......
......@@ -45,6 +45,8 @@ define(['require', 'backgrid', 'asBreadcrumbs'], function(require) {
Backgrid.Cell.prototype.initialize = function() {
cellInit.apply(this, arguments);
var className = this.column.get('className');
var rowClassName = this.column.get('rowClassName');
if (rowClassName) this.$el.addClass(rowClassName);
if (className) this.$el.addClass(className);
}
/*
......
......@@ -117,9 +117,16 @@ define(['require',
bindEvents: function() {
var that = this;
this.listenTo(this.collection, 'reset', function() {
var collectionJSON = this.collection.toJSON();
if (collectionJSON[0].id && 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[0].values) {
......@@ -127,7 +134,11 @@ define(['require',
this.description = collectionJSON[0].values.description;
if (this.name) {
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 {
this.ui.title.hide();
}
......
......@@ -23,8 +23,9 @@ define(['require',
'models/VEntity',
'utils/Utils',
'dagreD3',
'd3-tip'
], function(require, Backbone, LineageLayoutViewtmpl, VLineageList, VEntity, Utils, dagreD3, d3Tip) {
'd3-tip',
'utils/Globals'
], function(require, Backbone, LineageLayoutViewtmpl, VLineageList, VEntity, Utils, dagreD3, d3Tip, Globals) {
'use strict';
var LineageLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -110,19 +111,24 @@ define(['require',
function addValueInObject(data) {
var obj = {};
if (data && data.definition && data.definition.values) {
var values = data.definition.values;
obj['label'] = values.name.trunc(20);
obj['toolTiplabel'] = values.name;
obj['id'] = data.GUID;
if (values.queryText) {
obj['queryText'] = values.queryText;
if (data && data.definition) {
if (data.definition.values) {
var values = data.definition.values;
obj['label'] = values.name.trunc(20);
obj['toolTiplabel'] = values.name;
obj['id'] = data.GUID;
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 {
obj['label'] = vertices[val].values.name;
obj['toolTiplabel'] = values.name;
obj['label'] = ""
obj['toolTiplabel'] = "";
}
obj['shape'] = "img";
obj['class'] = "type-TOP";
if (data.GUID) {
that.g.setNode(data.GUID, obj);
......@@ -177,6 +183,11 @@ define(['require',
obj['class'] = "type-TOP";
obj['shape'] = "img";
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) {
that.g.setNode(val, obj);
}
......@@ -283,13 +294,17 @@ define(['require',
.attr("xlink:href", function(d) {
if (node) {
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';
} else {
return '../img/icon-table.png';
}
} 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';
} else {
return '../img/icon-gear.png';
......
......@@ -289,10 +289,17 @@ define(['require',
return new Date(rawValue);
}
if (model.get('name') == rawValue) {
var nameHtml = "";
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 {
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 {
return rawValue;
......@@ -313,7 +320,12 @@ define(['require',
className: 'searchTag',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
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',
if (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',
model.getEntity(guid, {
beforeSend: function() {},
success: function(data) {
if (data.definition && 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);
if (data.definition) {
if (data.definition.id && data.definition.id.state) {
if (Globals.entityStateReadOnly[data.definition.id.state]) {
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) {},
......@@ -387,17 +411,25 @@ define(['require',
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$) {
var guid = model.toJSON().guid;
++that.fetchList;
model.getEntity(guid, {
beforeSend: function() {},
success: function(data) {
if (data.definition && 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);
if (data.definition) {
if (data.definition.id && data.definition.id.state) {
if (Globals.entityStateReadOnly[data.definition.id.state]) {
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) {},
......@@ -406,7 +438,7 @@ define(['require',
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