Commit 9b8a5ddc by kevalbhatt

ATLAS-1477, ATLAS-1556 : Edit entity button not working from search table of tag detail page.

parent 58bbee4c
...@@ -174,6 +174,7 @@ define([ ...@@ -174,6 +174,7 @@ define([
if (tagName) { if (tagName) {
App.rNContent.show(new TagDetailLayoutView({ App.rNContent.show(new TagDetailLayoutView({
'tag': tagName, 'tag': tagName,
'entityDefCollection': that.entityDefCollection,
'collection': that.tagCollection 'collection': that.tagCollection
})); }));
} }
......
...@@ -112,9 +112,7 @@ define(['require', ...@@ -112,9 +112,7 @@ define(['require',
} }
} }
}).open(); }).open();
this.modal.$el.find('button.ok').attr("disabled", true); this.modal.$el.find('button.ok').attr("disabled", true);
this.ui.entityList.val("");
this.modal.on('ok', function(e) { this.modal.on('ok', function(e) {
that.okButton(); that.okButton();
}); });
...@@ -154,23 +152,37 @@ define(['require', ...@@ -154,23 +152,37 @@ define(['require',
if (value && value.length) { if (value && value.length) {
JSON.parse(value); JSON.parse(value);
$(this).removeClass('errorClass'); $(this).removeClass('errorClass');
that.modal.$el.find('button.ok').prop("disabled", false);
} }
} catch (err) { } catch (err) {
$(this).addClass('errorClass'); $(this).addClass('errorClass');
that.modal.$el.find('button.ok').prop("disabled", true);
} }
}); });
if (this.guid) {
this.bindNonRequiredField();
}
this.ui.entityInputData.on('keyup change dp.change', 'input.true,select.true', function(e) { this.ui.entityInputData.on('keyup change dp.change', 'input.true,select.true', function(e) {
if (this.value !== "") { if (this.value !== "") {
if ($(this).data('select2')) { if ($(this).data('select2')) {
$(this).data('select2').$container.find('.select2-selection').removeClass("errorClass") $(this).data('select2').$container.find('.select2-selection').removeClass("errorClass");
if (that.ui.entityInputData.find('.errorClass').length === 0) {
that.modal.$el.find('button.ok').prop("disabled", false);
}
} else { } else {
$(this).removeClass('errorClass'); $(this).removeClass('errorClass');
if (that.ui.entityInputData.find('.errorClass').length === 0) {
that.modal.$el.find('button.ok').prop("disabled", false);
}
} }
} else { } else {
if ($(this).data('select2')) { if ($(this).data('select2')) {
$(this).data('select2').$container.find('.select2-selection').addClass("errorClass") $(this).data('select2').$container.find('.select2-selection').addClass("errorClass");
that.modal.$el.find('button.ok').prop("disabled", true);
} else { } else {
$(this).addClass('errorClass'); $(this).addClass('errorClass');
that.modal.$el.find('button.ok').prop("disabled", true);
} }
} }
}); });
...@@ -179,6 +191,14 @@ define(['require', ...@@ -179,6 +191,14 @@ define(['require',
this.bindEvents(); this.bindEvents();
this.fetchCollections(); this.fetchCollections();
}, },
bindNonRequiredField: function() {
var that = this;
this.ui.entityInputData.off('keyup change dp.change', 'input.false,select.false').on('keyup change dp.change', 'input.false,select.false', function(e) {
if (that.modal.$el.find('button.ok').prop('disabled') && that.ui.entityInputData.find('.errorClass').length === 0) {
that.modal.$el.find('button.ok').prop("disabled", false);
}
});
},
decrementCounter: function(counter) { decrementCounter: function(counter) {
if (this[counter] > 0) { if (this[counter] > 0) {
--this[counter]; --this[counter];
...@@ -205,7 +225,7 @@ define(['require', ...@@ -205,7 +225,7 @@ define(['require',
this.ui.assetName.html(name); this.ui.assetName.html(name);
this.onEntityChange(null, this.entityData); this.onEntityChange(null, this.entityData);
} else { } else {
var str = '<option selected="selected" disabled="disabled">--Select entity-type--</option>'; var str = '<option disabled="disabled" selected>--Select entity-type--</option>';
this.entityDefCollection.fullCollection.comparator = function(model) { this.entityDefCollection.fullCollection.comparator = function(model) {
return model.get('name'); return model.get('name');
} }
...@@ -245,7 +265,6 @@ define(['require', ...@@ -245,7 +265,6 @@ define(['require',
}, },
onEntityChange: function(e, value) { onEntityChange: function(e, value) {
this.modal.$el.find('button.ok').prop("disabled", false);
var that = this, var that = this,
typeName = value && value.get('entity') ? value.get('entity').typeName : null; typeName = value && value.get('entity') ? value.get('entity').typeName : null;
this.showLoader(); this.showLoader();
...@@ -325,6 +344,9 @@ define(['require', ...@@ -325,6 +344,9 @@ define(['require',
if (this.ui.entityInputData.find('fieldset').length > 0 && this.ui.entityInputData.find('select.true,input.true').length === 0) { if (this.ui.entityInputData.find('fieldset').length > 0 && this.ui.entityInputData.find('select.true,input.true').length === 0) {
this.requiredAllToggle(this.ui.entityInputData.find('select.true,input.true').length === 0); this.requiredAllToggle(this.ui.entityInputData.find('select.true,input.true').length === 0);
if (!this.guid) {
this.bindNonRequiredField();
}
this.ui.toggleRequired.prop('checked', true); this.ui.toggleRequired.prop('checked', true);
} else { } else {
this.ui.entityInputData.find('fieldset').each(function() { this.ui.entityInputData.find('fieldset').each(function() {
...@@ -579,8 +601,8 @@ define(['require', ...@@ -579,8 +601,8 @@ define(['require',
if (that.guid && that.callback) { if (that.guid && that.callback) {
that.callback(); that.callback();
} else { } else {
if (model.entitiesMutated && (model.entitiesMutated.CREATE || model.entitiesMutated.UPDATE)) { if (model.createdEntities && _.isArray(model.createdEntities) && model.createdEntities[0] && model.createdEntities[0].guid) {
that.setUrl('#!/detailPage/' + (model.entitiesMutated.CREATE ? model.entitiesMutated.CREATE[0].guid : model.entitiesMutated.UPDATE[0].guid), true); that.setUrl('#!/detailPage/' + (model.createdEntities[0].guid), true);
} }
} }
}, },
...@@ -619,7 +641,6 @@ define(['require', ...@@ -619,7 +641,6 @@ define(['require',
var that = this, var that = this,
queryText, queryText,
str = ''; str = '';
// Add oprions in select // Add oprions in select
if (this.selectStoreCollection.length) { if (this.selectStoreCollection.length) {
var appendOption = function(optionValue) { var appendOption = function(optionValue) {
...@@ -654,9 +675,6 @@ define(['require', ...@@ -654,9 +675,6 @@ define(['require',
if (that.guid) { if (that.guid) {
var dataValue = that.entityData.get("entity").attributes[keyData]; var dataValue = that.entityData.get("entity").attributes[keyData];
var selectedValue = []; var selectedValue = [];
// if (that.selectStoreCollection.length) {
// var selectedValue = [];
// }
var setValue = function(selectValue) { var setValue = function(selectValue) {
var obj = selectValue.toJSON(); var obj = selectValue.toJSON();
if (dataValue !== null && _.isArray(dataValue)) { if (dataValue !== null && _.isArray(dataValue)) {
......
...@@ -44,7 +44,7 @@ define(['require', ...@@ -44,7 +44,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'tag', 'collection')); _.extend(this, _.pick(options, 'tag', 'collection', 'entityDefCollection'));
}, },
bindEvents: function() {}, bindEvents: function() {},
onRender: function() { onRender: function() {
...@@ -60,6 +60,7 @@ define(['require', ...@@ -60,6 +60,7 @@ define(['require',
}; };
that.RSearchResultLayoutView.show(new SearchResultLayoutView({ that.RSearchResultLayoutView.show(new SearchResultLayoutView({
value: value, value: value,
entityDefCollection: that.entityDefCollection,
tag: that.tag tag: that.tag
})); }));
}); });
......
...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ...@@ -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) ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES: ALL CHANGES:
ATLAS-1556 Edit entity button not working from search table of tag detail page. (kevalbhatt)
ATLAS-1559 Regression - If a new tag is created then the earlier tags doesn't render properly (kevalbhatt) ATLAS-1559 Regression - If a new tag is created then the earlier tags doesn't render properly (kevalbhatt)
ATLAS-1508 Make AtlasADAuthenticationProvider like Ranger ADLdap Methods (gss2002 via mneethiraj) ATLAS-1508 Make AtlasADAuthenticationProvider like Ranger ADLdap Methods (gss2002 via mneethiraj)
ATLAS-1547 Add tests for DeleteHandlerV1 (sumasai via mneethiraj) ATLAS-1547 Add tests for DeleteHandlerV1 (sumasai 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