Commit 590b38ac by kalyanikk Committed by Madhan Neethiraj

ATLAS-1402: UI issues due to v2 API integration

parent 40e639ed
......@@ -155,10 +155,6 @@
width: 300px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
width: 327px !important;
}
.typeLOV {
.select2-container--default {
.select2-selection--multiple {
......
......@@ -365,10 +365,10 @@ legend.scheduler-border {
.spanEntityType {
position: absolute;
right: 38px;
right: 45px;
top: 10px;
cursor: help;
width: 45px;
width: 40px;
overflow: hidden;
z-index: 9;
text-overflow: ellipsis;
......
......@@ -30,6 +30,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8; Cache-Control: no-cache" />
<meta http-equiv="X-Frame-Options" content="deny">
<title>Atlas</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
......
......@@ -99,9 +99,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}
if (value.length > 1) {
scope.$('td div[data-id="' + id + '"]').html('<a href="#!/detailPage/' + id + '">' + value + '</a>');
scope.$('td div[data-id="' + id + '"]').html('<a href="#!/detailPage/' + id + '">' + _.escape(value) + '</a>');
} else {
scope.$('td div[data-id="' + id + '"]').html('<a href="#!/detailPage/' + id + '">' + id + '</a>');
scope.$('td div[data-id="' + id + '"]').html('<a href="#!/detailPage/' + id + '">' + _.escape(id) + '</a>');
}
if (deleteButton.length) {
scope.$('td div[data-id="' + id + '"]').addClass('block readOnlyLink');
......@@ -118,6 +118,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
});
}
_.keys(valueObject).map(function(key) {
key = _.escape(key)
var keyValue = valueObject[key],
valueOfArray = [];
if (_.isArray(keyValue) || _.isObject(keyValue)) {
......@@ -132,7 +133,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
readOnly = false;
if (_.isString(inputOutputField) || _.isBoolean(inputOutputField) || _.isNumber(inputOutputField)) {
if (inputOutputField.indexOf("$") == -1) {
valueOfArray.push('<span>' + inputOutputField + '</span>');
valueOfArray.push('<span>' + _.escape(inputOutputField) + '</span>');
}
} else if (_.isObject(inputOutputField) && !inputOutputField.attributes && !id) {
_.each(inputOutputField, function(objValue, objKey) {
......@@ -141,7 +142,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (_.isObject(value)) {
value = JSON.stringify(value);
}
valueOfArray.push('<span>' + objKey + ':' + value + '</span>');
valueOfArray.push('<span>' + _.escape(objKey) + ':' + _.escape(value) + '</span>');
}
});
}
......@@ -149,18 +150,18 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (id && inputOutputField) {
if (inputOutputField.attributes) {
if (inputOutputField.attributes.name) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.attributes.name + '</a>'
tempLink += '<a href="#!/detailPage/' + id + '">' + _.escape(inputOutputField.attributes.name) + '</a>'
} else if (inputOutputField.attributes.qualifiedName) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.attributes.qualifiedName + '</a>'
tempLink += '<a href="#!/detailPage/' + id + '">' + _.escape(inputOutputField.attributes.qualifiedName) + '</a>'
} else if (inputOutputField.typeName) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.typeName + '</a>'
tempLink += '<a href="#!/detailPage/' + id + '">' + _.escape(inputOutputField.typeName) + '</a>'
} else {
tempLink += '<a href="#!/detailPage/' + id + '">' + id + '</a>'
}
} else if (inputOutputField.name) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.name + '</a>';
tempLink += '<a href="#!/detailPage/' + id + '">' + _.escape(inputOutputField.name) + '</a>';
} else if (inputOutputField.qualifiedName) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.qualifiedName + '</a>'
tempLink += '<a href="#!/detailPage/' + id + '">' + _.escape(inputOutputField.qualifiedName) + '</a>'
} else {
var fetch = true;
fetchInputOutputValue(id);
......@@ -191,7 +192,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (searchTable) {
table = subLink;
} else {
table += '<tr><td>' + key + '</td><td>' + subLink + '</td></tr>';
table += '<tr><td>' + key + '</td><td>' + _.escape(subLink) + '</td></tr>';
}
} else {
if (key.indexOf("Time") !== -1 || key == "retention") {
......@@ -208,7 +209,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
table = valueObject[key];
}
} else {
table += '<tr><td>' + key + '</td><td>' + valueObject[key] + '</td></tr>';
table += '<tr><td>' + key + '</td><td>' + _.escape(valueObject[key]) + '</td></tr>';
}
}
}
......@@ -236,13 +237,13 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (i == 0) {
href = splitUrlWithoutTerm[i];
urlList.push({
value: splitUrlWithoutTerm[i],
value: _.escape(splitUrlWithoutTerm[i]),
href: href
});
} else {
href += "/terms/" + splitUrlWithoutTerm[i];
urlList.push({
value: splitUrlWithoutTerm[i],
value: _.escape(splitUrlWithoutTerm[i]),
href: href
});
};
......@@ -254,7 +255,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
var li = "";
if (options.urlList) {
_.each(options.urlList, function(object) {
li += '<li><a class="link" href="#!/taxonomy/detailCatalog/api/atlas/v1/taxonomies/' + object.href + '?load=true">' + object.value + '</a></li>';
li += '<li><a class="link" href="#!/taxonomy/detailCatalog/api/atlas/v1/taxonomies/' + object.href + '?load=true">' + _.escape(object.value) + '</a></li>';
});
}
if (options.scope) {
......@@ -300,8 +301,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}
if (tagName.term) {
terms.push({
deleteHtml: '<a class="pull-left" title="Remove Term"><i class="fa fa-trash" data-id="tagClick" data-type="term" data-assetname="' + model.get("name") + '" data-name="' + tagName.fullName + '" data-guid="' + (model.get('$id$').id || model.get('$id$')) + '" ></i></a>',
url: tagName.fullName.split(".").join("/"),
deleteHtml: '<a class="pull-left" title="Remove Term"><i class="fa fa-trash" data-id="tagClick" data-type="term" data-assetname="' + _.escape(model.get("name")) + '" data-name="' + tagName.fullName + '" data-guid="' + (model.get('$id$').id || model.get('$id$')) + '" ></i></a>',
url: _.unescape(tagName.fullName).split(".").join("/"),
name: tagName.fullName
});
}
......@@ -312,7 +313,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
className += "showHideDiv hide";
}
obj['valueUrl'] = CommonViewFunction.breadcrumbUrlMaker(obj.url);
html += '<div class="' + className + '" dataterm-name="' + obj.name + '"><div class="liContent"></div>' + obj.deleteHtml + '</div>';
html += '<div class="' + className + '" dataterm-name="' + _.escape(obj.name) + '"><div class="liContent"></div>' + obj.deleteHtml + '</div>';
})
if (terms.length > 1) {
html += '<div><a href="javascript:void(0)" data-id="showMoreLessTerm" class="inputTag inputTagGreen"><span>Show More </span><i class="fa fa-angle-right"></i></a></div>'
......
......@@ -49,33 +49,33 @@ define(['require', 'utils/Globals', 'pnotify'], function(require, Globals, pnoti
};
var notify = function(options) {
new pnotify(_.extend({ icon: true, hide: true, delay: 3000,remove:true }, options));
new pnotify(_.extend({ icon: true, hide: true, delay: 3000, remove: true }, options));
}
Utils.notifyInfo = function(options) {
notify({
type: "info",
text: options.content || "Info message."
text: _.escape(options.content) || "Info message."
});
};
Utils.notifyWarn = function(options) {
notify({
type: "notice",
text: options.content || "Info message."
text: _.escape(options.content) || "Info message."
});
};
Utils.notifyError = function(options) {
notify({
type: "error",
text: options.content || "Error occurred."
text: _.escape(options.content) || "Error occurred."
});
};
Utils.notifySuccess = function(options) {
notify({
type: "success",
text: options.content || "Error occurred."
text: _.escape(options.content) || "Error occurred."
});
};
Utils.defaultErrorHandler = function(model, error) {
......@@ -243,7 +243,7 @@ define(['require', 'utils/Globals', 'pnotify'], function(require, Globals, pnoti
if (value == "TaxonomyTerm") {
return {}
}
var name = value.split('.');
var name = _.escape(value).split('.');
return {
term: true,
tag: false,
......@@ -261,7 +261,7 @@ define(['require', 'utils/Globals', 'pnotify'], function(require, Globals, pnoti
if (name === "TaxonomyTerm") {
return {}
}
name = name.split('.');
name = _.escape(name).split('.');
var trem = false;
if (value['taxonomy.namespace']) {
trem = true;
......
......@@ -58,7 +58,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'guid'));
_.extend(this, _.pick(options, 'globalVent', 'guid', 'vent'));
this.entityCollection = new VEntityList();
this.count = 26;
this.entityCollection.url = UrlLinks.entityCollectionaudit(this.guid);
......@@ -79,6 +79,7 @@ define(['require',
paginatorOpts: {}
};
this.currPage = 1;
this.bindEvents();
// this.pageFrom = 1;
// this.pageTo = this.count;
},
......@@ -91,6 +92,17 @@ define(['require',
});
this.renderTableLayoutView();
},
bindEvents: function() {
var that = this;
this.listenTo(this.vent, "reset:collection", function() {
this.fetchCollection({
next: this.ui.nextAuditData,
nextClick: false,
previous: this.ui.previousAuditData
});
}, this);
},
getToOffset: function() {
var toOffset = 0;
if (this.entityCollection.models.length < this.count) {
......@@ -141,7 +153,6 @@ define(['require',
if ((that.entityCollection.models.length < that.count && that.currPage == 1) && that.next == that.entityCollection.last().get('eventKey')) {
options.next.attr('disabled', true);
options.previous.removeAttr("disabled");
//that.renderTableLayoutView();
} else {
if (that.entityCollection.models.length > 0) {
that.next = that.entityCollection.last().get('eventKey');
......@@ -149,8 +160,9 @@ define(['require',
options.previous.attr('disabled', true);
}
}
that.renderTableLayoutView();
}
that.renderTableLayoutView();
},
silent: true
});
......
......@@ -70,7 +70,7 @@ define(['require',
var valueObject = detailsObject.values;
if (this.action == Enums.auditAction.TAG_ADD) {
this.ui.auditHeaderValue.html('<th>Tag</th>');
this.ui.auditValue.html("<tr><td>" + detailsObject.typeName + "</td></tr>");
this.ui.auditValue.html("<tr><td>" + _.escape(detailsObject.typeName) + "</td></tr>");
} else {
this.ui.auditHeaderValue.html('<th>Key</th><th>New Value</th>');
table = CommonViewFunction.propertyTable(valueObject, this);
......@@ -86,7 +86,7 @@ define(['require',
} else if (this.action == Enums.auditAction.TAG_DELETE) {
var appendedString = this.entityModel.get('details').split(':');
this.ui.auditHeaderValue.html('<th>Tag</th>');
this.ui.auditValue.html("<tr><td>" + appendedString[1] + "</td></tr>");
this.ui.auditValue.html("<tr><td>" + _.escape(appendedString[1]) + "</td></tr>");
}
},
......
......@@ -104,7 +104,7 @@ define(['require',
}
if (description) {
this.ui.description.show();
this.ui.description.html('<span>' + description + '</span>');
this.ui.description.html('<span>' + _.escape(description) + '</span>');
} else {
this.ui.description.hide();
}
......@@ -129,56 +129,6 @@ define(['require',
this.ui.editButton.show();
this.ui.editBox.hide();
},
addTagCollectionList: function(obj, searchString) {
var list = "",
that = this;
_.each(obj, function(model) {
var tags = model.get("tags");
if (!_.contains(that.tagElement, tags)) {
if (searchString) {
if (tags.search(new RegExp(searchString, "i")) != -1) {
list += '<div><span>' + tags + '</span></div>';
return;
}
} else {
list += '<div><span>' + tags + '</span></div>';
}
}
});
if (list.length <= 0) {
list += '<div><span>' + "No more tags" + '</span></div>';
}
this.ui.appendList.html(list);
},
addTagToTerms: function(tagObject) {
var tagData = "";
_.each(tagObject, function(val) {
tagData += '<span class="inputTag"><span class="inputValue">' + val + '</span><i class="fa fa-close" data-id="deleteTag"></i></span>';
});
this.$('.addTag-dropdown').before(tagData);
},
saveTagFromList: function(ref) {
var that = this;
this.entityModel = new VEntity();
var tagName = ref.text();
var json = {
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Struct",
"typeName": tagName,
"values": {}
};
this.entityModel.saveEntity(this.id, {
data: JSON.stringify(json),
success: function(data) {
that.collection.fetch({ reset: true });
},
error: function(error, data, status) {
if (error && error.responseText) {
var data = JSON.parse(error.responseText);
}
},
complete: function() {}
});
},
onEditButton: function(e) {
var that = this;
$(e.currentTarget).blur();
......@@ -186,7 +136,7 @@ define(['require',
'views/tag/CreateTagLayoutView',
'modules/Modal'
], function(CreateTagLayoutView, Modal) {
var view = new CreateTagLayoutView({ 'termCollection': that.collection, 'descriptionData': that.model.get('description'), 'tag': that.termName.name });
var view = new CreateTagLayoutView({ 'termCollection': that.collection, 'descriptionData': that.model.get('description'), 'tag': _.unescape(that.termName.name) });
var modal = new Modal({
title: 'Edit Term',
content: view,
......
......@@ -41,7 +41,7 @@ define(['require',
var that = this;
$(this.el).html(this.template());
if (Globals.userLogedIn.status) {
that.$('.userName').html(Globals.userLogedIn.response.userName);
that.$('.userName').text(Globals.userLogedIn.response.userName);
}
var that = this;
if (this.url) {
......
......@@ -259,11 +259,11 @@ define(['require',
if (isParent) {
this.parentCollection.url = this.url;
this.parentCollection.fullCollection.reset(undefined, { silent: true });
this.parentCollection.fetch({ reset: true,cache:true });
this.parentCollection.fetch({ reset: true, cache: true });
} else {
this.childCollection.url = this.url + "?hierarchy/path:.";
this.childCollection.fullCollection.reset(undefined, { silent: true });
this.childCollection.fetch({ reset: true });
this.childCollection.fetch({ reset: true, cache: true });
}
},
showLoader: function() {
......@@ -530,7 +530,7 @@ define(['require',
assetName = $(e.target).data("assetname"),
that = this,
modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Delete: " + "<b>" + termName + "?</b></div>" +
msg: "<div class='ellipsis'>Delete: " + "<b>" + _.escape(termName) + "?</b></div>" +
"<p class='termNote'>Assets mapped to this term will be unclassified.</p>",
titleMessage: Messages.deleteTerm,
buttonText: "Delete"
......@@ -616,7 +616,7 @@ define(['require',
var view = new AddTermLayoutView({
url: UrlLinks.taxonomiesApiUrl(),
model: new that.parentCollection.model(),
defaultTerm:true
defaultTerm: true
});
var modal = new Modal({
title: 'Taxonomy',
......
......@@ -113,6 +113,7 @@ define(['require',
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'collection', 'vent', 'id'));
this.bindEvents();
this.auditVent = new Backbone.Wreqr.EventAggregator();
},
bindEvents: function() {
var that = this;
......@@ -151,7 +152,7 @@ define(['require',
this.description = collectionJSON.attributes.description;
if (this.name) {
this.ui.title.show();
var titleName = '<span>' + this.name + '</span>';
var titleName = '<span>' + _.escape(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>';
}
......@@ -161,18 +162,18 @@ define(['require',
}
if (this.description) {
this.ui.description.show();
this.ui.description.html('<span>' + this.description + '</span>');
this.ui.description.html('<span>' + _.escape(this.description) + '</span>');
} else {
this.ui.description.hide();
}
}
if (collectionJSON.classifications) {
this.addTagToTerms(collectionJSON.classifications);
}else{
} else {
this.addTagToTerms([]);
}
}
this.auditVent.trigger("reset:collection");
this.renderEntityDetailTableLayoutView();
this.renderTagTableLayoutView(tagGuid);
this.renderTermTableLayoutView(tagGuid);
......@@ -199,13 +200,13 @@ define(['require',
that = this;
if (tagOrTerm === "term") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + tagName + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>",
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>",
titleMessage: Messages.removeTerm,
buttonText: "Remove"
});
} else if (tagOrTerm === "tag") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + tagName + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>",
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>",
titleMessage: Messages.removeTag,
buttonText: "Remove"
});
......@@ -344,7 +345,8 @@ define(['require',
require(['views/audit/AuditTableLayoutView'], function(AuditTableLayoutView) {
that.RAuditTableLayoutView.show(new AuditTableLayoutView({
globalVent: that.globalVent,
guid: tagGuid
guid: tagGuid,
vent: that.auditVent
}));
});
},
......
......@@ -115,7 +115,7 @@ define(['require',
}
}
}).open();
var enable = false;
this.modal.$el.find('button.ok').attr("disabled", true);
this.ui.entityList.val("");
$(this.ui.entityInputData).on('keyup change dp.change', that.modal.$el.find('input select textarea'), function(e) {
that.ui.entityInputData.find("input,select,textarea").each(function() {
......@@ -176,7 +176,7 @@ define(['require',
value;
if (this.guid) {
this.collection.each(function(val) {
name += val.get("attributes").name || val.get("attributes").qualifiedName || val.get("attributes").id;
name += _.escape(val.get("attributes").name) || _.escape(val.get("attributes").qualifiedName) || _.escape(val.get("attributes").id);
that.entityData = val;
});
this.ui.assetName.html(name);
......@@ -187,7 +187,7 @@ define(['require',
return model.get('name');
}
this.collection.fullCollection.sort().each(function(val) {
str += '<option>' + val.get("name") + '</option>';
str += '<option>' + _.escape(val.get("name")) + '</option>';
});
this.ui.entityList.html(str);
}
......@@ -208,6 +208,7 @@ define(['require',
},
onEntityChange: function(e, value) {
this.modal.$el.find('button.ok').prop("disabled", false);
var that = this,
typeName;
this.showLoader();
......@@ -464,6 +465,7 @@ define(['require',
}
} else {
if (that.selectStoreCollection.length && pickKey) {
var temp = {} // I9 support;
temp[pickKey] = $(this).val();
var parseData = that.selectStoreCollection.findWhere(temp).toJSON();
......@@ -554,7 +556,7 @@ define(['require',
} else if (value.get("id")) {
labelName = "id";
}
str += '<option>' + value.get(labelName) + '</option>';
str += '<option>' + _.escape(value.get(labelName)) + '</option>';
});
}
}
......@@ -591,7 +593,7 @@ define(['require',
var dataValue = that.entityData.get("attributes")[keyData];
if (dataValue !== null) {
_.each(dataValue, function(obj) {
str += '<option>' + obj + '</option>';
str += '<option>' + _.escape(obj) + '</option>';
});
$this.html(str);
}
......
......@@ -414,13 +414,13 @@ define(['require',
that = this;
if (tagOrTerm === "term") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + tagName + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTerm,
buttonText: "Remove"
});
} else if (tagOrTerm === "tag") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + tagName + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTag,
buttonText: "Remove"
});
......
......@@ -124,7 +124,7 @@ define(['require',
return model.get('name').toLowerCase();
}
this.typecollection.fullCollection.sort().each(function(model) {
str += '<option>' + model.get("name") + '</option>';
str += '<option>' + _.escape(model.get("name")) + '</option>';
});
that.ui.typeLov.html(str);
},
......
......@@ -269,7 +269,7 @@ define(['require',
if (that.searchCollection.models.length) {
that.startRenderTableProcess();
}
var resultData = 'Results for <b>' + that.searchCollection.queryParams.query + '</b>';
var resultData = 'Results for <b>' + _.escape(that.searchCollection.queryParams.query) + '</b>';
var multiAssignDataTag = '<a href="javascript:void(0)" class="inputAssignTag multiSelectTag assignTag" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i>' + " " + 'Assign Tag</a>';
if (Globals.taxonomy) {
var multiAssignDataTerm = '<a href="javascript:void(0)" class="inputAssignTag multiSelect" style="display:none" data-id="addTerm"><i class="fa fa-folder-o"></i>' + " " + 'Assign Term</a>';
......@@ -279,7 +279,8 @@ define(['require',
}
},
silent: true
silent: true,
reset: true
});
},
startRenderTableProcess: function() {
......@@ -444,13 +445,13 @@ define(['require',
}
}
if (model.get('$id$')) {
nameHtml = '<a href="#!/detailPage/' + (model.get('$id$').id || model.get('$id$')) + '">' + rawValue + '</a>';
nameHtml = '<a href="#!/detailPage/' + (model.get('$id$').id || model.get('$id$')) + '">' + _.escape(rawValue) + '</a>';
} else {
nameHtml = '<a>' + rawValue + '</a>';
nameHtml = '<a>' + _.escape(rawValue) + '</a>';
}
if (model.get('$id$') && model.get('$id$').state && Enums.entityStateReadOnly[model.get('$id$').state]) {
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>';
return '<div class="readOnly readOnlyLink">' + _.escape(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>'
return nameHtml;
......@@ -488,7 +489,7 @@ 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-giud= "' +(model.get('$id$').id || model.get('$id$')) + '" class="btn btn-atlasAction btn-atlas editBtn"><i class="fa fa-pencil"></i></button>'
nameHtml += '<button title="Edit" 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;
}
}
......@@ -619,13 +620,13 @@ define(['require',
that = this;
if (tagOrTerm === "term") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + tagName + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTerm,
buttonText: "Remove"
});
} else if (tagOrTerm === "tag") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + tagName + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTag,
buttonText: "Remove"
});
......
......@@ -87,7 +87,7 @@ define(['require',
if (this.create) {
this.tagCollectionList();
} else {
this.ui.title.html('<span>' + this.tag + '</span>');
this.ui.title.html('<span>' + _.escape(this.tag) + '</span>');
}
if (!('placeholder' in HTMLInputElement.prototype)) {
this.ui.createTagForm.find('input,textarea').placeholder();
......@@ -98,7 +98,7 @@ define(['require',
that = this;
this.ui.parentTag.empty();
this.tagCollection.fullCollection.each(function(val) {
str += '<option>' + val.get("name") + '</option>';
str += '<option>' + _.escape(val.get("name")) + '</option>';
});
that.ui.parentTag.html(str);
console.log(platform);
......
......@@ -46,6 +46,7 @@ define(['require',
addTagListBtn: '[data-id="addTagListBtn"]',
addTagtext: '[data-id="addTagtext"]',
addTagPlus: '[data-id="addTagPlus"]',
addTagBtn: '[data-id="addTagBtn"]',
description: '[data-id="description"]',
descriptionTextArea: '[data-id="descriptionTextArea"]',
publishButton: '[data-id="publishButton"]'
......@@ -69,13 +70,29 @@ define(['require',
bindEvents: function() {
this.listenTo(this.collection, 'reset', function() {
this.model = this.collection.fullCollection.findWhere({ name: this.tag });
/// this.model = this.collection.fullCollection.findWhere({ typeName: $(".dataTypeSelector").val() });
if (this.model) {
this.renderTagDetail();
} else {
this.ui.addTagBtn.hide();
this.ui.editButton.hide();
Utils.notifyError({
content: 'Something went wrong'
});
}
}, this);
this.listenTo(this.tagCollection, 'error', function(error, response) {
this.ui.addTagBtn.hide();
this.ui.editButton.hide();
if (response.responseJSON && response.responseJSON.error) {
Utils.notifyError({
content: response.responseJSON.error
});
} else {
Utils.notifyError({
content: 'Something went wrong'
});
}
}, this);
......@@ -93,17 +110,17 @@ define(['require',
var attributeData = "",
attributeDefs = this.model.get("attributeDefs");
if (this.model.get("name")) {
this.ui.title.html('<span>' + this.model.get("name") + '</span>');
this.ui.title.html('<span>' + _.escape(this.model.get("name")) + '</span>');
}
if (this.model.get("description")) {
this.ui.description.html(this.model.get("description"));
this.ui.description.text(this.model.get("description"));
}
if (this.model.get("attributeDefs")) {
if (!_.isArray(attributeDefs)) {
attributeDefs = [attributeDefs];
}
_.each(attributeDefs, function(value, key) {
attributeData += '<span class="inputAttribute">' + value.name + '</span>';
attributeData += '<span class="inputAttribute">' + _.escape(value.name) + '</span>';
});
this.ui.showAttribute.html(attributeData);
}
......@@ -190,11 +207,11 @@ define(['require',
this.ui.editButton.show();
this.ui.editBox.hide();
},
textAreaChangeEvent: function(view, modal) {
textAreaChangeEvent: function(view) {
if (this.model.get('description') === view.ui.description.val()) {
modal.$el.find('button.ok').prop('disabled', true);
this.modal.$el.find('button.ok').prop('disabled', true);
} else {
modal.$el.find('button.ok').prop('disabled', false);
this.modal.$el.find('button.ok').prop('disabled', false);
}
},
onPublishClick: function(view) {
......@@ -210,7 +227,7 @@ define(['require',
'modules/Modal'
], function(CreateTagLayoutView, Modal) {
var view = new CreateTagLayoutView({ 'tagCollection': that.collection, 'model': that.model, 'tag': that.tag });
var modal = new Modal({
that.modal = new Modal({
title: 'Edit Tag',
content: view,
cancelText: "Cancel",
......@@ -218,14 +235,14 @@ define(['require',
allowCancel: true,
}).open();
view.ui.description.on('keyup', function(e) {
that.textAreaChangeEvent(view, modal);
that.textAreaChangeEvent(view);
});
modal.$el.find('button.ok').prop('disabled', true);
modal.on('ok', function() {
that.modal.$el.find('button.ok').prop('disabled', true);
that.modal.on('ok', function() {
that.onPublishClick(view);
});
modal.on('closeModal', function() {
modal.trigger('cancel');
that.modal.on('closeModal', function() {
that.modal.trigger('cancel');
});
});
}
......
......@@ -136,7 +136,7 @@ define(['require',
var stringArr = [];
tagValue = "";
_.each(values, function(val, key) {
var attrName = "<span>" + key + ":" + val + "</span>";
var attrName = "<span>" + _.escape(key) + ":" + _.escape(val) + "</span>";
stringArr.push(attrName);
});
tagValue += stringArr.join(", ");
......@@ -178,13 +178,13 @@ define(['require',
that = this;
if (that.term) {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + tagName + "</b> assignment from" + " " + "<b>" + this.assetName + "?</b></div>",
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.assetName + "?</b></div>",
titleMessage: Messages.removeTerm,
buttonText: "Remove",
});
} else {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + tagName + "</b> assignment from" + " " + "<b>" + this.assetName + "?</b></div>",
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.assetName + "?</b></div>",
titleMessage: Messages.removeTag,
buttonText: "Remove",
});
......
......@@ -147,15 +147,16 @@ define(['require',
return model.get('name').toLowerCase();
};
that.collection.fullCollection.sort().each(function(model) {
var name = _.escape(model.get('name'))
if (searchString) {
if (model.get('name').search(new RegExp(searchString, "i")) != -1) {
if (name.search(new RegExp(searchString, "i")) != -1) {
// data-name="<space>'<tagName>'" Space is required for DSL search Input
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('name') + '" data-name="`' + model.get('name') + '`" >' + model.get('name') + '</a></li>';
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name=" `' + name + '`" >' + name + '</a></li>';
} else {
return;
}
} else {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('name') + '" data-name="`' + model.get('name') + '`">' + model.get('name') + '</a></li>';
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name=" `' + name + '`">' + name + '</a></li>';
}
});
this.ui.tagsParent.empty().html(str);
......@@ -187,7 +188,7 @@ define(['require',
modal.$el.find('button.ok').removeAttr("disabled");
});
view.ui.tagName.on('keyup', function(e) {
if (e.keyCode == 8 && e.currentTarget.value == "") {
if ((e.keyCode == 8 || e.keyCode == 32 || e.keyCode == 46) && e.currentTarget.value == "") {
modal.$el.find('button.ok').attr("disabled", "true");
}
});
......
......@@ -57,6 +57,7 @@ define(['require',
cancelText: "Cancel",
allowCancel: true,
}).open();
this.modal.$el.find('button.ok').attr("disabled", true);
this.on('ok', function() {
var tagName = this.ui.addTagOptions.val();
var tagAttributes = {};
......@@ -103,11 +104,11 @@ define(['require',
this.tagsCollection();
}, this);
this.listenTo(this.commonCollection, 'reset', function() {
--this.asyncAttrFetchCounter;
--this.asyncAttrFetchCounter
this.subAttributeData();
}, this);
this.listenTo(this.commonCollection, 'error', function() {
--this.asyncAttrFetchCounter;
--this.asyncAttrFetchCounter
this.$('.attrLoader').hide();
}, this);
},
......@@ -118,17 +119,17 @@ define(['require',
var str = '<option selected="selected" disabled="disabled">-- Select a tag from the dropdown list --</option>';
this.collection.fullCollection.sort().each(function(obj, key) {
str += '<option>' + obj.get('name') + '</option>';
str += '<option>' + _.escape(obj.get('name')) + '</option>';
});
this.ui.addTagOptions.html(str);
this.ui.addTagOptions.select2({
placeholder: "Select Tag",
allowClear: true
allowClear: false
});
},
onChangeTagDefination: function() {
this.ui.tagAttribute.empty();
var saveBtn = this.modal.$el.find('.btn-success');
var saveBtn = this.modal.$el.find('button.ok');
saveBtn.prop("disabled", false);
var tagname = this.ui.addTagOptions.val();
this.hideAttributeBox();
......@@ -157,7 +158,7 @@ define(['require',
if (this.commonCollection.models[0]) {
if (this.commonCollection.models[0].get('attributeDefs')) {
_.each(this.commonCollection.models[0].get('attributeDefs'), function(obj) {
that.ui.tagAttribute.append('<div class="form-group"><label>' + obj.name + '</label>' +
that.ui.tagAttribute.append('<div class="form-group"><label>' + _.escape(obj.name) + '</label>' +
'<input type="text" class="form-control attributeInputVal attrName" data-key="' + obj.name + '" ></input></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