Commit c74ba142 by kevalbhatt Committed by Madhan Neethiraj

ATLAS-1575: fix for UI issue in create/edit of hive_table entity

parent b7d880dd
...@@ -137,7 +137,9 @@ define(['require', ...@@ -137,7 +137,9 @@ define(['require',
this.decrementCounter('asyncFetchLOVCounter'); this.decrementCounter('asyncFetchLOVCounter');
_.each(this.searchCollection.fullCollection.models, function(model) { _.each(this.searchCollection.fullCollection.models, function(model) {
var obj = model.toJSON(); var obj = model.toJSON();
obj['queryText'] = model.collection.queryText; if (that.searchCollection && that.searchCollection.queryText) {
obj['queryText'] = that.searchCollection.queryText;
}
that.selectStoreCollection.push(obj); that.selectStoreCollection.push(obj);
}) })
this.addJsonSearchData(); this.addJsonSearchData();
...@@ -241,6 +243,7 @@ define(['require', ...@@ -241,6 +243,7 @@ define(['require',
} }
}); });
this.ui.entityList.html(str); this.ui.entityList.html(str);
this.ui.entityList.select2({});
} }
}, },
capitalize: function(string) { capitalize: function(string) {
...@@ -488,6 +491,10 @@ define(['require', ...@@ -488,6 +491,10 @@ define(['require',
var entity = {}; var entity = {};
var referredEntities = {}; var referredEntities = {};
var extractValue = function(value) { var extractValue = function(value) {
if (!value) {
return value;
}
if (_.isArray(value)) { if (_.isArray(value)) {
if (that.selectStoreCollection.length) { if (that.selectStoreCollection.length) {
var parseData = []; var parseData = [];
...@@ -574,6 +581,8 @@ define(['require', ...@@ -574,6 +581,8 @@ define(['require',
if (_.isString(value)) { if (_.isString(value)) {
if (value.length) { if (value.length) {
entity[datakeyEntity] = value; entity[datakeyEntity] = value;
} else {
entity[datakeyEntity] = null;
} }
} else { } else {
entity[datakeyEntity] = value; entity[datakeyEntity] = value;
...@@ -601,8 +610,8 @@ define(['require', ...@@ -601,8 +610,8 @@ define(['require',
if (that.guid && that.callback) { if (that.guid && that.callback) {
that.callback(); that.callback();
} else { } else {
if (model.createdEntities && _.isArray(model.createdEntities) && model.createdEntities[0] && model.createdEntities[0].guid) { if (model.mutatedEntities && model.mutatedEntities.CREATE && _.isArray(model.mutatedEntities.CREATE) && model.mutatedEntities.CREATE[0] && model.mutatedEntities.CREATE[0].guid) {
that.setUrl('#!/detailPage/' + (model.createdEntities[0].guid), true); that.setUrl('#!/detailPage/' + (model.mutatedEntities.CREATE[0].guid), true);
} }
} }
}, },
...@@ -646,11 +655,13 @@ define(['require', ...@@ -646,11 +655,13 @@ define(['require',
var appendOption = function(optionValue) { var appendOption = function(optionValue) {
var obj = optionValue.toJSON(), var obj = optionValue.toJSON(),
labelName = (_.escape(obj.displayText) || _.escape(obj.attributes && obj.attributes.name ? obj.attributes.name : null) || obj.guid); labelName = (_.escape(obj.displayText) || _.escape(obj.attributes && obj.attributes.name ? obj.attributes.name : null) || obj.guid);
optionValue.set('labelName', labelName); if (obj && obj.queryText) {
if (labelName) { optionValue.set('labelName', labelName);
var str = '<option>' + _.escape(labelName) + '</option>'; if (labelName) {
var str = '<option>' + _.escape(labelName) + '</option>';
}
that.$('select[data-queryData="' + obj.queryText + '"]').append(str);
} }
this.$('select[data-queryData="' + obj.queryText + '"]').append(str);
} }
_.each(this.selectStoreCollection.models, function(value) { _.each(this.selectStoreCollection.models, function(value) {
var obj = value.toJSON(); var obj = value.toJSON();
...@@ -701,7 +712,7 @@ define(['require', ...@@ -701,7 +712,7 @@ define(['require',
}); });
// Array of string. // Array of string.
if (selectedValue.length === 0 && dataValue && dataValue.length) { if (selectedValue.length === 0 && dataValue && dataValue.length && $this.data('querydata') === "string") {
var str = ""; var str = "";
_.each(dataValue, function(obj) { _.each(dataValue, function(obj) {
if (_.isString(obj)) { if (_.isString(obj)) {
......
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