Commit 49453f28 by kalyanikk Committed by Madhan Neethiraj

ATLAS-1437: UI update to disallow tag association changes to deleted entities

parent cc08c517
......@@ -310,6 +310,11 @@ ul {
display: none;
}
}
button {
&.editbutton[data-id="editButton"] {
display: none;
}
}
}
@media (min-width: 768px) {
......
......@@ -15,14 +15,13 @@
* limitations under the License.
-->
<form name="tagDefinitionform" class="css-form" onsubmit="return false;">
<!-- <h4 style="margin-bottom:30px">Add Term</h4> -->
<div class="form-group">
{{#if defaultTerm}}
<input class="form-control" data-id="termName" placeholder="Enter Taxonomy Name" autofocus>
{{#if defaultTerm}}
<input class="form-control" data-id="termName" placeholder="Enter Taxonomy Name" autofocus>
<p class='alertTerm' style='display:none'>Taxonomy name should not have spaces</p>
{{else}}
{{else}}
<input class="form-control" data-id="termName" placeholder="Name(Required)" autofocus>
<p class='alertTerm' style='display:none'>Term name should not have spaces</p>
<p class='alertTerm' style='display:none'>Term name should not have spaces</p>
{{/if}}
</div>
<div class="form-group">
......
......@@ -21,8 +21,6 @@
<a target="_blank" href="http://atlas.incubator.apache.org/"><i class="fa fa-question-circle"></i></a>
<a href="javascript:void(0);" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user user-circle"></i><span class="userName"></span></a>
<ul class="dropdown-menu">
<!-- <li><a href="#">Edit Profile</a></li>
<li><a href="#">Change Password</a></li> -->
<li class="aboutAtlas"><a href="javascript:void(0)">About</a></li>
<li role="separator" class="divider"></li>
<li><a href="logout.html"><i class="fa fa-sign-out"></i>Logout</a></li>
......
......@@ -15,7 +15,6 @@
* limitations under the License.
-->
<form name="entityDefinitionform" class="css-form">
<!-- <h4 style="margin-bottom:30px"></h4> -->
<div class="form-group">
<div class="col-sm-12">
<div class="row">
......
......@@ -14,9 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!-- <div class="panel-heading">
<h3 class="panel-title">Lineage</h3>
</div> -->
<div class="panel-body graph-bg resize-graph" align="center">
<div class="graph" id="tree-container">
</div>
......
......@@ -19,8 +19,6 @@
<a target="_blank" href="http://atlas.incubator.apache.org/"><i class="fa fa-question-circle"></i></a>
<a href="javascript:void(0);" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="user-dropdown"><i class="fa fa-user user-circle "></i><span class="userName"></span></a>
<ul class="dropdown-menu">
<!-- <li><a href="#">Edit Profile</a></li>
<li><a href="#">Change Password</a></li> -->
<li class="aboutAtlas"><a href="javascript:void(0)">About</a></li>
<li role="separator" class="divider"></li>
<li>
......
......@@ -15,9 +15,8 @@
* limitations under the License.
-->
<div>
<!-- <button class="add-tag btn btn-success pull-right" data-id="addTag" style="margin-bottom:10px">Add Tag</button> -->
</div>
<div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
<div id="r_tagTermTableLayoutView"></div>
\ No newline at end of file
<div id="r_tagTermTableLayoutView"></div>
......@@ -15,7 +15,6 @@
* limitations under the License.
-->
<form name="tagDefinitionform" class="css-form" data-id="createTagForm">
<!-- <h4 style="margin-bottom:30px"></h4> -->
<div class="form-group">
{{#if create}}
<input class="form-control row-margin-bottom" data-id="tagName" placeholder="Name(required)" autofocus>
......
......@@ -80,7 +80,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
success: function(data) {
var value = "",
deleteButton = "";
if (data && data.attributes) {
if (data.attributes.name) {
value = data.attributes.name;
......@@ -92,11 +91,10 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}
var id = "";
if (data.guid) {
if (Enums.entityStateReadOnly[data.attributes.state]) {
if (Enums.entityStateReadOnly[data.status]) {
deleteButton += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
}
id = data.guid;
}
if (value.length > 1) {
scope.$('td div[data-id="' + id + '"]').html('<a href="#!/detailPage/' + id + '">' + _.escape(value) + '</a>');
......@@ -131,6 +129,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
id = inputOutputField.guid || inputOutputField.id,
tempLink = "",
readOnly = false;
if (Enums.entityStateReadOnly[inputOutputField.status]) {
readOnly = inputOutputField.status
}
if (_.isString(inputOutputField) || _.isBoolean(inputOutputField) || _.isNumber(inputOutputField)) {
if (inputOutputField.indexOf("$") == -1) {
valueOfArray.push('<span>' + _.escape(inputOutputField) + '</span>');
......@@ -169,7 +170,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
tempLink += '<div data-id="' + fetchId + '"></div>';
}
}
if (readOnly) {
if (!fetch) {
tempLink += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
......@@ -364,10 +364,10 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
require(['models/VCatalog'], function(Vcatalog) {
var VCatalog = new Vcatalog();
var name = options.termName;
++that.asyncFetchCounter;
VCatalog.url = function() {
return "api/atlas/v1/entities/" + options.guid + "/tags/" + name;
};
++that.asyncFetchCounter;
VCatalog.save(null, {
success: function(data) {
Utils.notifySuccess({
......
......@@ -20,8 +20,6 @@ define(['require'], function(require) {
'use strict';
var Globals = {};
//Globals.baseURL = '/api/atlas';
Globals.settings = {};
Globals.settings.PAGE_SIZE = 25;
Globals.saveApplicationState = {
......@@ -38,6 +36,5 @@ define(['require'], function(require) {
status: false,
response: {}
}
return Globals;
});
......@@ -33,7 +33,8 @@ define(['require'], function(require) {
addAttributeSuccessMessage: "Tag attribute is added successfully",
updateTagDescriptionMessage: "Tag description is updated successfully",
updateTermDescriptionMessage: "Term description is updated successfully",
editSuccessMessage: " has been updated successfully"
editSuccessMessage: " has been updated successfully",
assignDeletedEntity: " entity is deleted, Tag cannot be assign"
};
return Messages;
});
......@@ -181,30 +181,6 @@ define(['require',
this.collection.trigger("sort");
});
/*this.listenTo(this.collection, 'remove', function(model, collection, response){
if (model.isNew() || !this.includePagination) {
return;
}
if (this.collection.state && this.collection.state.totalRecords>0) {
this.collection.state.totalRecords-=1;
}
if (this.collection.length===0 && this.collection.state && this.collection.state.totalRecords>0) {
if (this.collection.state.totalRecords>this.collection.state.currentPage*this.collection.state.pageSize) {
this.collection.fetch({reset:true});
} else {
if (this.collection.state.currentPage>0) {
this.collection.state.currentPage-=1;
this.collection.fetch({reset:true});
}
}
} else if (this.collection.length===0 && this.collection.state && this.collection.state.totalRecords===0) {
this.collection.state.currentPage=0;
this.collection.fetch({reset:true});
}
}, this);*/
// It will show tool tip when td has ellipsis Property
this.listenTo(this.collection, "backgrid:refresh", function() {
/*this.$('.table td').bind('mouseenter', function() {
......
......@@ -39,7 +39,6 @@ define(['require',
/** ui selector cache */
ui: {
auditValue: "[data-id='auditValue']",
auditCreate: "[data-id='auditCreate']",
previousAuditData: "[data-id='previousAuditData']",
nextAuditData: "[data-id='nextAuditData']",
......@@ -80,8 +79,6 @@ define(['require',
};
this.currPage = 1;
this.bindEvents();
// this.pageFrom = 1;
// this.pageTo = this.count;
},
onRender: function() {
$.extend(this.entityCollection.queryParams, { count: this.count });
......
......@@ -23,8 +23,9 @@ define(['require',
'modules/Modal',
'collection/VCatalogList',
'utils/CommonViewFunction',
'utils/Messages'
], function(require, Backbone, AddTermToEntityLayoutViewTmpl, Utils, Modal, VCatalogList, CommonViewFunction, Messages) {
'utils/Messages',
'utils/Enums'
], function(require, Backbone, AddTermToEntityLayoutViewTmpl, Utils, Modal, VCatalogList, CommonViewFunction, Messages, Enums) {
'use strict';
var AddTermToEntityLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -50,7 +51,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'modalCollection', 'callback', 'multiple', 'showLoader'));
_.extend(this, _.pick(options, 'guid', 'modalCollection', 'callback', 'multiple', 'showLoader', 'hideLoader'));
this.vCatalogList = new VCatalogList();
var that = this;
this.modal = new Modal({
......@@ -73,9 +74,21 @@ define(['require',
}
var obj = {
termName: termName,
guid: that.multiple[i].id.id
guid: that.multiple[i].id.id,
deletedEntity: Enums.entityStateReadOnly[that.multiple[i].id.state],
entityName: that.multiple[i].model.get('name')
};
CommonViewFunction.saveTermToAsset(obj, that);
if (obj.deletedEntity) {
Utils.notifyError({
content: obj.entityName + Messages.assignDeletedEntity
});
if (that.multiple.length === 1 || (that.multiple.length == (i + 1) && that.asyncFetchCounter == 0)) {
that.hideLoader();
}
} else {
CommonViewFunction.saveTermToAsset(obj, that);
}
}
} else {
that.asyncFetchCounter = 0;
......
......@@ -31,7 +31,6 @@ define(['require',
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'url', 'collection'));
this.value = [];
},
/**
* After Page Render createBrudCrum called.
......
......@@ -67,7 +67,9 @@ define(['require',
/** ui events hash */
events: function() {
var events = {};
events["click " + this.ui.editButton] = 'onClickEditEntity';
if (Globals.entityCrud) {
events["click " + this.ui.editButton] = 'onClickEditEntity';
}
events["click " + this.ui.tagClick] = function(e) {
if (e.target.nodeName.toLocaleLowerCase() != "i") {
var scope = $(e.currentTarget);
......@@ -111,9 +113,15 @@ define(['require',
var collectionJSON = this.collection.first().toJSON();
if (collectionJSON && collectionJSON.guid) {
var tagGuid = collectionJSON.guid;
this.readOnly = Enums.entityStateReadOnly[collectionJSON.status];
} else {
var tagGuid = this.id;
}
if (this.readOnly) {
this.$el.addClass('readOnly');
} else {
this.$el.removeClass('readOnly');
}
if (collectionJSON) {
if (collectionJSON.attributes) {
if (collectionJSON.attributes.name) {
......
......@@ -209,9 +209,7 @@ define(['require',
if (value && (value.query === undefined || value.query.trim() === "")) {
return;
}
this.$('.fontLoader').show();
this.$('.searchTable').hide();
this.$('.searchResult').hide();
this.showLoader();
if (Globals.searchApiCallRef) {
Globals.searchApiCallRef.abort();
}
......@@ -312,9 +310,7 @@ define(['require',
checkTableFetch: function() {
if (this.asyncFetchCounter <= 0) {
this.$('div[data-id="r_tableSpinner"]').removeClass('show');
this.$('.fontLoader').hide();
this.$('.searchTable').show();
this.$('.searchResult').show();
this.hideLoader();
}
},
getEntityTableColumns: function() {
......@@ -453,7 +449,9 @@ define(['require',
nameHtml += '<button type="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 {
nameHtml += '<button title="Edit" data-id="editEntityButton" data-giud= "' + (model.get('$id$').id || model.get('$id$')) + '" class="btn btn-atlasAction btn-atlas editBtn"><i class="fa fa-pencil"></i></button>'
if (Globals.entityCrud) {
nameHtml += '<button title="Edit" data-id="editEntityButton" data-giud= "' + (model.get('$id$').id || model.get('$id$')) + '" class="btn btn-atlasAction btn-atlas editBtn"><i class="fa fa-pencil"></i></button>'
}
return nameHtml;
}
}
......@@ -563,16 +561,24 @@ define(['require',
that.fetchCollection();
that.arr = [];
},
showLoader: function() {
that.$('.fontLoader').show();
that.$('.searchTable').hide();
}
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that)
});
// view.saveTagData = function() {
//override saveTagData function
// }
});
},
showLoader: function() {
this.$('.fontLoader').show();
this.$('.searchTable').hide();
this.$('.searchResult').hide();
},
hideLoader: function() {
this.$('.fontLoader').hide();
this.$('.searchTable').show();
this.$('.searchResult').show();
},
checkedValue: function(e) {
var guid = "",
that = this;
......@@ -605,10 +611,8 @@ define(['require',
that.fetchCollection();
that.arr = [];
},
showLoader: function() {
that.$('.fontLoader').show();
that.$('.searchTable').hide();
}
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that)
});
});
},
......
......@@ -72,9 +72,7 @@ define(['require',
collection: that.collection
}));
});
},
}
});
return TagDetailLayoutView;
});
......@@ -19,13 +19,11 @@
define(['require',
'backbone',
'hbs!tmpl/tag/TagLayoutView_tmpl',
'collection/VTagList',
'collection/VEntityList',
'utils/Utils',
'utils/Messages',
'utils/Globals',
'utils/UrlLinks'
], function(require, Backbone, TagLayoutViewTmpl, VTagList, VEntityList, Utils, Messages, Globals, UrlLinks) {
], function(require, Backbone, TagLayoutViewTmpl, Utils, Messages, Globals, UrlLinks) {
'use strict';
var TagLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -44,7 +42,6 @@ define(['require',
createTag: "[data-id='createTag']",
tags: "[data-id='tags']",
offLineSearchTag: "[data-id='offlineSearchTag']",
deleteTerm: "[data-id='deleteTerm']",
refreshTag: '[data-id="refreshTag"]'
},
/** ui events hash */
......@@ -53,7 +50,6 @@ define(['require',
events["click " + this.ui.createTag] = 'onClickCreateTag';
events["click " + this.ui.tags] = 'onTagList';
events["keyup " + this.ui.offLineSearchTag] = 'offlineSearchTag';
events["click " + this.ui.deleteTerm] = 'onDeleteTerm';
events['click ' + this.ui.refreshTag] = 'fetchCollections';
return events;
},
......@@ -265,7 +261,6 @@ define(['require',
}
});
},
setUrl: function(url, create) {
Utils.setUrl({
url: url,
......@@ -277,10 +272,6 @@ define(['require',
});
},
onTagList: function(e, toggle) {
/*if (toggle) {
var assetUl = $(e.currentTarget).siblings('.tagAsset')
assetUl.slideToggle("slow");
}*/
this.ui.tagsParent.find('li').removeClass("active");
$(e.currentTarget).addClass("active");
},
......
......@@ -23,8 +23,10 @@ define(['require',
'modules/Modal',
'models/VEntity',
'utils/Utils',
'utils/UrlLinks'
], function(require, AddTagModalViewTmpl, VTagList, VCommonList, Modal, VEntity, Utils, UrlLinks) {
'utils/UrlLinks',
'utils/Enums',
'utils/Messages',
], function(require, AddTagModalViewTmpl, VTagList, VCommonList, Modal, VEntity, Utils, UrlLinks, Enums, Messages) {
'use strict';
var AddTagModel = Marionette.LayoutView.extend({
......@@ -46,7 +48,7 @@ define(['require',
*/
initialize: function(options) {
var that = this;
_.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader'));
_.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader', 'hideLoader'));
this.collection = new VTagList();
this.commonCollection = new VTagList();
this.asyncAttrFetchCounter = 0;
......@@ -76,9 +78,20 @@ define(['require',
var obj = {
tagName: tagName,
tagAttributes: tagAttributes,
guid: (_.isObject(that.multiple[i].id) ? that.multiple[i].id.id : that.multiple[i].id)
guid: (_.isObject(that.multiple[i].id) ? that.multiple[i].id.id : that.multiple[i].id),
deletedEntity: Enums.entityStateReadOnly[that.multiple[i].id.state],
entityName: that.multiple[i].model.get('name')
}
if (obj.deletedEntity) {
Utils.notifyError({
content: obj.entityName + Messages.assignDeletedEntity
});
if (that.multiple.length === 1 || (that.multiple.length == (i + 1) && that.asyncFetchCounter == 0)) {
that.hideLoader();
}
} else {
that.saveTagData(obj);
}
that.saveTagData(obj);
}
} else {
that.asyncFetchCounter = 0;
......
......@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ATLAS-1437 UI update to disallow tag association changes to deleted entities (Kalyanikashikar via mneethiraj)
ATLAS-1352 fix for error in redirecting to Knox gateway URL (nixonrodrigues via mneethiraj)
ATLAS-1467 instance create/full-Update implementation (sumasai via mneethiraj)
ATLAS-1463 option to exclude specific entity attributes in audit records (sarath.kum4r@gmail.com via mneethiraj)
......
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