Commit 38fd4f35 by Keval Bhatt

ATLAS-1091 : Improvement in DSL search functionality.(kevalbhatt)

parent 81ceabbd
...@@ -25,6 +25,7 @@ $action_gray:#999999; ...@@ -25,6 +25,7 @@ $action_gray:#999999;
$color_keppel_approx: #37bb9b; $color_keppel_approx: #37bb9b;
$color_gallery_approx: #eee; $color_gallery_approx: #eee;
$gray: #808080; $gray: #808080;
$dark_gray:#666;
$color_tuna_approx: #323544; $color_tuna_approx: #323544;
$color_celeste_approx: #ccc; $color_celeste_approx: #ccc;
$color_cornflower_blue_approx: #66afe9; $color_cornflower_blue_approx: #66afe9;
...@@ -38,7 +39,7 @@ $color_ironside_gray_approx: #686868; ...@@ -38,7 +39,7 @@ $color_ironside_gray_approx: #686868;
$color_mercury_approx: #e6e6e6; $color_mercury_approx: #e6e6e6;
$color_whisper_approx: #f6f7fa; $color_whisper_approx: #f6f7fa;
$color_bombay_approx: #b5b9bc; $color_bombay_approx: #b5b9bc;
$red: red; $red: #f00;
//theme color //theme color
//colors //colors
$color_white_lilac_approx: #f6f7fb; $color_white_lilac_approx: #f6f7fb;
...@@ -100,7 +101,6 @@ $black_80: rgba(0, 0, 0, 0.8); ...@@ -100,7 +101,6 @@ $black_80: rgba(0, 0, 0, 0.8);
$color_bright_turquoise_approx: #00ffd0; $color_bright_turquoise_approx: #00ffd0;
$color_mountain_mist_approx: #999; $color_mountain_mist_approx: #999;
$color_suva_gray_approx: #868686; $color_suva_gray_approx: #868686;
// $tag_color:#9599a0;
$tag_color:#4A90E2; $tag_color:#4A90E2;
$delete_link:#BB5838; $delete_link:#BB5838;
//urls //urls
......
...@@ -132,10 +132,49 @@ ...@@ -132,10 +132,49 @@
} }
} }
.select2-container .select2-selection--single { .select2-container {
height: 34px; .select2-selection--single,
.select2-selection__rendered { .select2-selection--multiple {
padding-left: 12px; min-height: 34px;
.select2-selection__rendered {
padding-left: 12px;
}
}
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: $white;
color: $color_mountain_mist_approx;
border: 1px solid $tag_color;
}
.select2-container--default .select2-search--inline .select2-search__field {
color: #555;
}
.typeLOV {
.select2-container--default {
.select2-selection--multiple {
.select2-selection__rendered {
padding-right: 13px;
.select2-selection__choice {
font-size: 14px;
color: $color_mountain_mist_approx;
border: 1px solid $color_mountain_mist_approx;
}
.select2-search__field {
font-size: 14px;
}
}
.select2-selection__clear {
position: absolute;
float: none;
margin: 0px;
right: 4px;
top: 5px;
color: $color_mountain_mist_approx;
}
}
} }
} }
...@@ -182,3 +221,16 @@ ...@@ -182,3 +221,16 @@
.backgrid-paginator ul > .disabled > a:hover { .backgrid-paginator ul > .disabled > a:hover {
cursor: pointer; cursor: pointer;
} }
.popover-content {
ul {
color: $dark_gray;
padding: 0px 5px;
margin-bottom: 0px;
cursor: pointer;
a {
color: $dark_gray;
padding: 5px;
}
}
}
...@@ -105,16 +105,6 @@ ...@@ -105,16 +105,6 @@
margin: 15px 0px; margin: 15px 0px;
} }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #fff;
color: #9599a0;
border: 1px solid $tag_color;
}
.select2-container--default .select2-search--inline .select2-search__field {
color: #555;
}
.inputTag { .inputTag {
display: inline-block; display: inline-block;
border: 1px $tag_color solid; border: 1px $tag_color solid;
...@@ -325,6 +315,14 @@ form-control .tagInpput { ...@@ -325,6 +315,14 @@ form-control .tagInpput {
float: right; float: right;
} }
.multiSelectTag {
float: right;
}
.inputAssignTag.multiSelectTag {
margin-right: 10px;
}
.popover.popoverTag { .popover.popoverTag {
display: block; display: block;
} }
......
...@@ -104,36 +104,12 @@ ...@@ -104,36 +104,12 @@
} }
} }
.termPopoverList {
color: #666;
padding: 0px 5px;
margin-bottom: 0px;
a {
color: #666;
padding: 5px;
}
}
.termPopover {
cursor: pointer;
}
.termMoveDiv { .termMoveDiv {
width: 550px; width: 550px;
height: 200px; height: 200px;
margin: 10px; margin: 10px;
} }
.tagPopoverList {
color: #666;
padding: 0px 5px;
margin-bottom: 0px;
a {
color: #666;
padding: 5px;
}
}
.toggleArrow { .toggleArrow {
position: absolute; position: absolute;
left: 0px; left: 0px;
...@@ -141,12 +117,12 @@ ...@@ -141,12 +117,12 @@
cursor: pointer; cursor: pointer;
} }
.addTermDiable { .addTermDisable {
border-color: #FF0000 !important; border-color: $red !important;
} }
.alertTerm { .alertTerm {
color: #FF0000 !important; color: $red !important;
} }
......
...@@ -33,7 +33,23 @@ define(['require', ...@@ -33,7 +33,23 @@ define(['require',
this.modelName = 'VSearch'; this.modelName = 'VSearch';
this.modelAttrName = 'results'; this.modelAttrName = 'results';
this.bindErrorEvents(); this.bindErrorEvents();
} },
parseRecords: function(resp, options) {
this.responseData = {
dataType: resp.dataType,
query: resp.query,
queryType: resp.queryType,
requestId: resp.requestId
};
try {
if (!this.modelAttrName) {
throw new Error("this.modelAttrName not defined for " + this);
}
return _.reject(resp[this.modelAttrName], _.isNull);
} catch (e) {
console.log(e);
}
},
}, },
//Static Class Members //Static Class Members
{ {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<button class="btn btn-atlasAction btn-atlas pull-right" onclick="this.blur();" title="Refresh" data-id="refreshTaxanomy"><i class="fa fa-refresh"></i></button> <button class="btn btn-atlasAction btn-atlas pull-right" onclick="this.blur();" title="Refresh" data-id="refreshTaxanomy"><i class="fa fa-refresh"></i></button>
</div> </div>
<div> <div>
<select type="text" class="form-control" data-id="searchTermInput" placeholder="Search term"></select> <select type="text" class="form-control" data-id="searchTermInput"></select>
</div> </div>
<div class=""> <div class="">
<ul class="taxonomyTree"> <ul class="taxonomyTree">
......
...@@ -29,18 +29,12 @@ ...@@ -29,18 +29,12 @@
</div> </div>
<div class="col-sm-12"> <div class="col-sm-12">
<div class="form-group"> <div class="form-group">
<input type="text" class="form-control" data-id="searchInput" placeholder="Search using a query string: e.g. sales_fact"> <div class="typeLOV">
</div> <select data-id="typeLOV"></select>
<!-- <div data-id="advanceSearchContainer">
<div class="form-group">
<select type="text" class="col-md-12 form-control tagListSelect" data-id="tagListInput" multiple></select>
</div>
<div class="form-group">
<select type="text" class="col-md-12 form-control" data-id="termListInput" multiple></select>
</div> </div>
</div> --> <input type="text" class="form-control" data-id="searchInput" placeholder="Search using a query string: e.g. sales_fact" style="margin-top: 5px;">
</div>
<div class="clearAdvanceSearch" data-id="clearSearch">Clear</div> <div class="clearAdvanceSearch" data-id="clearSearch">Clear</div>
<button class="btn btn-atlas advanceSearchBtn" data-id="searchBtn">Search</button> <button class="btn btn-atlas advanceSearchBtn" data-id="searchBtn" disabled="disabled">Search</button>
</div> </div>
</div> <div id="searchResult"></div>
<div id="searchResult"></div>
...@@ -315,11 +315,13 @@ define(['require', ...@@ -315,11 +315,13 @@ define(['require',
termSearchData: function() { termSearchData: function() {
var that = this; var that = this;
var str = '<option></option>'; var str = '<option></option>';
for (var j = 0; j < this.termCollection.models.length; j++) { this.termCollection.fullCollection.comparator = function(model) {
var terms = this.termCollection.models[j].attributes.name; return model.get('name');
str += '<option>' + terms + '</option>';
this.ui.searchTermInput.html(str);
} }
this.termCollection.fullCollection.sort().each(function(model) {
str += '<option>' + model.get('name') + '</option>';
});
this.ui.searchTermInput.html(str);
// this.ui.searchTermInput.setAttribute('data-href' : that.termCollection.url); // this.ui.searchTermInput.setAttribute('data-href' : that.termCollection.url);
this.ui.searchTermInput.select2({ this.ui.searchTermInput.select2({
placeholder: "Search Term", placeholder: "Search Term",
...@@ -480,11 +482,11 @@ define(['require', ...@@ -480,11 +482,11 @@ define(['require',
view.ui.termName.on('keyup', function() { view.ui.termName.on('keyup', function() {
if (this.value.indexOf(' ') >= 0) { if (this.value.indexOf(' ') >= 0) {
modal.$el.find('button.ok').prop('disabled', true); modal.$el.find('button.ok').prop('disabled', true);
view.ui.termName.addClass("addTermDiable"); view.ui.termName.addClass("addTermDisable");
view.$('.alertTerm').show(); view.$('.alertTerm').show();
} else { } else {
modal.$el.find('button.ok').prop('disabled', false); modal.$el.find('button.ok').prop('disabled', false);
view.ui.termName.removeClass("addTermDiable"); view.ui.termName.removeClass("addTermDisable");
view.$('.alertTerm').hide(); view.$('.alertTerm').hide();
} }
}); });
...@@ -626,11 +628,11 @@ define(['require', ...@@ -626,11 +628,11 @@ define(['require',
view.ui.termName.on('keyup', function() { view.ui.termName.on('keyup', function() {
if (this.value.indexOf(' ') >= 0) { if (this.value.indexOf(' ') >= 0) {
modal.$el.find('button.ok').prop('disabled', true); modal.$el.find('button.ok').prop('disabled', true);
view.ui.termName.addClass("addTermDiable"); view.ui.termName.addClass("addTermDisable");
view.$('.alertTerm').show(); view.$('.alertTerm').show();
} else { } else {
modal.$el.find('button.ok').prop('disabled', false); modal.$el.find('button.ok').prop('disabled', false);
view.ui.termName.removeClass("addTermDiable"); view.ui.termName.removeClass("addTermDisable");
view.$('.alertTerm').hide(); view.$('.alertTerm').hide();
} }
}); });
......
...@@ -19,10 +19,9 @@ ...@@ -19,10 +19,9 @@
define(['require', define(['require',
'backbone', 'backbone',
'hbs!tmpl/search/SearchLayoutView_tmpl', 'hbs!tmpl/search/SearchLayoutView_tmpl',
'collection/VSearchList', 'collection/VTagList',
'utils/Utils', 'utils/Utils',
'collection/VTagList' ], function(require, Backbone, SearchLayoutViewTmpl, VTagList, Utils) {
], function(require, Backbone, SearchLayoutViewTmpl, VSearchList, Utils, VTagList) {
'use strict'; 'use strict';
var SearchLayoutView = Backbone.Marionette.LayoutView.extend( var SearchLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -37,33 +36,30 @@ define(['require', ...@@ -37,33 +36,30 @@ define(['require',
/** ui selector cache */ /** ui selector cache */
ui: { ui: {
searchButton: '[data-id="searchButton"]',
searchInput: '[data-id="searchInput"]', searchInput: '[data-id="searchInput"]',
searchType: 'input[name="queryType"]', searchType: 'input[name="queryType"]',
advanceSearch: '[data-id="advanceSearch"]',
tagList: '[data-id="tagList"]',
tagListInput: '[data-id="tagListInput"]',
termListInput: '[data-id="termListInput"]',
searchBtn: '[data-id="searchBtn"]', searchBtn: '[data-id="searchBtn"]',
clearSearch: '[data-id="clearSearch"]' clearSearch: '[data-id="clearSearch"]',
typeLov: '[data-id="typeLOV"]'
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
var events = {}, var events = {},
that = this; that = this;
events["keyup " + this.ui.searchInput] = function(e) { events["keyup " + this.ui.searchInput] = function(e) {
this.ui.searchBtn.removeAttr("disabled");
var code = e.which; var code = e.which;
this.ui.searchBtn.removeAttr("disabled");
if (code == 13) { if (code == 13) {
that.findSearchResult(); that.findSearchResult();
} }
if (code == 8 && this.ui.searchInput.val() == "") { if (code == 8 && this.ui.searchInput.val() == "" && this.ui.typeLov.val() == "") {
this.ui.searchBtn.attr("disabled", "true"); this.ui.searchBtn.attr("disabled", "true");
} }
}; };
events["change " + this.ui.searchType] = 'dslFulltextToggle'; events["change " + this.ui.searchType] = 'dslFulltextToggle';
events["click " + this.ui.searchBtn] = 'findSearchResult'; events["click " + this.ui.searchBtn] = 'findSearchResult';
events["click " + this.ui.clearSearch] = 'clearSearchData'; events["click " + this.ui.clearSearch] = 'clearSearchData';
events["change " + this.ui.typeLov] = 'onChangeTypeList';
return events; return events;
}, },
/** /**
...@@ -72,44 +68,98 @@ define(['require', ...@@ -72,44 +68,98 @@ define(['require',
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'value')); _.extend(this, _.pick(options, 'globalVent', 'value'));
this.searchCollection = new VSearchList([], { this.typecollection = new VTagList([], {});
state: {
firstPage: 0,
pageSize: 10
}
});
this.type = "fulltext"; this.type = "fulltext";
var param = Utils.getUrlState.getQueryParams();
this.query = {
dsl: {
query: ""
},
fulltext: {
query: ""
}
};
this.dsl = false;
if (param && param.query && param.searchType) {
this.query[param.searchType].query = param.query;
}
this.bindEvents(); this.bindEvents();
}, },
bindEvents: function(param) { bindEvents: function(param) {
this.listenTo(this.searchCollection, "reset", function(value) { this.listenTo(this.typecollection, "reset", function(value) {
this.renderTree(); this.renderTypeList();
this.setValues();
this.ui.typeLov.select2({
placeholder: "Search For",
allowClear: true
});
}, this); }, this);
}, },
onRender: function() { onRender: function() {
// array of tags which is coming from url // array of tags which is coming from url
this.$('.typeLOV').hide();
this.fetchCollection();
this.ui.searchBtn.attr("disabled", "true"); this.ui.searchBtn.attr("disabled", "true");
this.setValues(); },
fetchCollection: function(value) {
$.extend(this.typecollection.queryParams, { type: 'CLASS' });
this.typecollection.fetch({ reset: true });
}, },
manualRender: function(paramObj) { manualRender: function(paramObj) {
this.setValues(paramObj); this.setValues(paramObj);
}, },
renderTypeList: function() {
var that = this;
this.ui.typeLov.empty();
var str = '<option></option>';
this.typecollection.fullCollection.comparator = function(model) {
return model.get('tags');
}
this.typecollection.fullCollection.sort().each(function(model) {
str += '<option>' + model.get("tags") + '</option>';
});
that.ui.typeLov.html(str);
},
onChangeTypeList: function(e) {
if (this.ui.typeLov.select2('val') !== "") {
this.ui.searchBtn.removeAttr("disabled");
} else if (this.ui.searchInput.val() === "") {
this.ui.searchBtn.attr("disabled", "true");
}
},
setValues: function(paramObj) { setValues: function(paramObj) {
var arr = []; var arr = [],
that = this;
if (paramObj) { if (paramObj) {
this.value = paramObj; this.value = paramObj;
} }
if (this.value) { if (this.value) {
if (this.value.query.length) { if (this.value.dslChecked == "true" && this.dsl == false) {
// get only search value and append it to input box
this.ui.searchInput.val(this.value.query);
this.ui.searchBtn.removeAttr("disabled");
}
if (this.value.dslChecked == "true") {
this.ui.searchType.prop("checked", true).trigger("change"); this.ui.searchType.prop("checked", true).trigger("change");
} else { } else if (this.value.dslChecked == "false" && this.dsl == true) {
this.ui.searchType.prop("checked", false).trigger("change"); this.ui.searchType.prop("checked", false).trigger("change");
} }
if (this.value.query !== undefined) {
// get only search value and append it to input box
if (this.dsl) {
var query = this.value.query.split(" ");
if (query.length > 1) {
var typeList = query.shift();
} else {
var typeList = "";
}
if (this.ui.typeLov.data('select2')) {
this.ui.typeLov.val(typeList).trigger('change');
} else {
this.ui.typeLov.val(typeList);
}
this.ui.searchInput.val(query.join(" "));
} else {
this.ui.searchInput.val(this.value.query);
}
this.ui.searchBtn.removeAttr("disabled");
}
} }
this.bindEvents(arr); this.bindEvents(arr);
}, },
...@@ -117,18 +167,20 @@ define(['require', ...@@ -117,18 +167,20 @@ define(['require',
this.triggerSearch(this.ui.searchInput.val()); this.triggerSearch(this.ui.searchInput.val());
}, },
triggerSearch: function(value) { triggerSearch: function(value) {
if (!this.ui.searchType.is(':checked')) { if (this.ui.searchType.is(':checked')) {
this.type = "dsl"; this.type = "dsl";
} else if (!this.ui.searchType.is(':checked')) { } else if (!this.ui.searchType.is(':checked')) {
this.type = "fulltext"; this.type = "fulltext";
} }
if (this.ui.typeLov.select2('val') !== null && this.dsl === true) {
var advancedSearchValue = value; this.query[this.type].query = this.ui.typeLov.select2('val') + ' ' + value;
this.type = "fulltext"; } else {
this.query[this.type].query = value
}
Utils.setUrl({ Utils.setUrl({
url: '#!/search/searchResult', url: '#!/search/searchResult',
urlParams: { urlParams: {
query: advancedSearchValue, query: this.query[this.type].query,
searchType: this.type, searchType: this.type,
dslChecked: this.ui.searchType.is(':checked') dslChecked: this.ui.searchType.is(':checked')
}, },
...@@ -139,38 +191,35 @@ define(['require', ...@@ -139,38 +191,35 @@ define(['require',
trigger: true trigger: true
}); });
}, },
fetchCollection: function(value) {
if (value) {
this.searchCollection.url = "/api/atlas/discovery/search/" + this.type;
$.extend(this.searchCollection.queryParams, { 'query': value });
}
this.searchCollection.fetch({ reset: true });
},
dslFulltextToggle: function(e) { dslFulltextToggle: function(e) {
var paramQuery = "";
if (e.currentTarget.checked) { if (e.currentTarget.checked) {
this.type = "dsl"; this.type = "dsl";
this.dsl = true;
this.$('.typeLOV').show();
} else { } else {
this.dsl = false;
this.$('.typeLOV').hide();
this.type = "fulltext"; this.type = "fulltext";
} }
if (this.ui.searchInput.val() !== "") { Utils.setUrl({
Utils.setUrl({ url: '#!/search/searchResult',
url: '#!/search/searchResult', urlParams: {
urlParams: { query: this.query[this.type].query,
query: this.ui.searchInput.val(), searchType: this.type,
searchType: this.type, dslChecked: this.ui.searchType.is(':checked')
dslChecked: this.ui.searchType.is(':checked') },
}, updateTabState: function() {
updateTabState: function() { return { searchUrl: this.url, stateChanged: true };
return { searchUrl: this.url, stateChanged: true }; },
}, mergeBrowserUrl: false,
mergeBrowserUrl: false, trigger: true
trigger: true });
}); this.ui.searchInput.attr("placeholder", this.type == "dsl" ? 'Optional conditions' : 'Search using a query string: e.g. sales_fact');
//this.findSearchResult();
}
this.ui.searchInput.attr("placeholder", this.type == "dsl" ? 'Search using a DSL query: e.g. DataSet where name="sales_fact "' : 'Search using a query string: e.g. sales_fact');
}, },
clearSearchData: function() { clearSearchData: function() {
this.query[this.type].query = "";
this.ui.typeLov.val("").trigger("change");
this.ui.searchInput.val(""); this.ui.searchInput.val("");
this.ui.searchBtn.attr("disabled", "true"); this.ui.searchBtn.attr("disabled", "true");
Utils.setUrl({ Utils.setUrl({
......
...@@ -195,9 +195,12 @@ define(['require', ...@@ -195,9 +195,12 @@ define(['require',
}, },
fetchCollection: function(value) { fetchCollection: function(value) {
var that = this; var that = this;
if (value && (value.query === undefined || value.query === "")) {
return;
}
this.$('.fontLoader').show(); this.$('.fontLoader').show();
this.$('.searchTable').hide(); this.$('.searchTable').hide();
that.$('.searchResult').hide(); this.$('.searchResult').hide();
if (Globals.searchApiCallRef) { if (Globals.searchApiCallRef) {
Globals.searchApiCallRef.abort(); Globals.searchApiCallRef.abort();
} }
...@@ -208,7 +211,10 @@ define(['require', ...@@ -208,7 +211,10 @@ define(['require',
$.extend(this.searchCollection.queryParams, { limit: this.limit }); $.extend(this.searchCollection.queryParams, { limit: this.limit });
this.offset = 0; this.offset = 0;
} }
_.extend(this.searchCollection.queryParams, { 'query': value.query }); if (Utils.getUrlState.isTagTab()) {
this.searchCollection.url = "/api/atlas/discovery/search/dsl";
}
_.extend(this.searchCollection.queryParams, { 'query': value.query.trim() });
} }
Globals.searchApiCallRef = this.searchCollection.fetch({ Globals.searchApiCallRef = this.searchCollection.fetch({
success: function() { success: function() {
...@@ -239,7 +245,7 @@ define(['require', ...@@ -239,7 +245,7 @@ define(['require',
that.checkTableFetch(); that.checkTableFetch();
that.offset = that.offset - that.limit; that.offset = that.offset - that.limit;
if (that.firstFetch) { if (that.firstFetch) {
that.renderTableLayoutView(); that.startRenderTableProcess();
} }
} }
if (that.firstFetch) { if (that.firstFetch) {
...@@ -250,7 +256,7 @@ define(['require', ...@@ -250,7 +256,7 @@ define(['require',
} }
// checking length for not rendering the table // checking length for not rendering the table
if (that.searchCollection.models.length) { if (that.searchCollection.models.length) {
that.renderTableLayoutView(); that.startRenderTableProcess();
} }
var resultData = 'Results for <b>' + that.searchCollection.queryParams.query + '</b>' var resultData = 'Results for <b>' + that.searchCollection.queryParams.query + '</b>'
var multiAssignData = '<a href="javascript:void(0)" class="inputAssignTag multiSelect" style="display:none" data-id="addTerm"><i class="fa fa-folder-o"></i>' + " " + 'Assign Term</a>' var multiAssignData = '<a href="javascript:void(0)" class="inputAssignTag multiSelect" style="display:none" data-id="addTerm"><i class="fa fa-folder-o"></i>' + " " + 'Assign Term</a>'
...@@ -259,11 +265,14 @@ define(['require', ...@@ -259,11 +265,14 @@ define(['require',
silent: true silent: true
}); });
}, },
renderTableLayoutView: function() { startRenderTableProcess: function() {
this.getEntityTableColumns();
},
renderTableLayoutView: function(col) {
var that = this, var that = this,
count = 5; count = 5;
require(['utils/TableLayout'], function(TableLayout) { require(['utils/TableLayout'], function(TableLayout) {
var columns = new Backgrid.Columns(that.getEntityTableColumns()); var columns = new Backgrid.Columns(col);
that.REntityTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, { that.REntityTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
globalVent: that.globalVent, globalVent: that.globalVent,
columns: columns columns: columns
...@@ -295,9 +304,10 @@ define(['require', ...@@ -295,9 +304,10 @@ define(['require',
var responseData = this.searchCollection.responseData; var responseData = this.searchCollection.responseData;
if (this.searchCollection.responseData) { if (this.searchCollection.responseData) {
if (responseData.dataType && responseData.dataType.typeName.indexOf('_temp') == -1) { if (responseData.dataType && responseData.dataType.typeName.indexOf('_temp') == -1) {
return this.getFixedDslColumn(); that.renderTableLayoutView(that.getFixedDslColumn())
} else { } else {
var idFound = false; var idFound = false,
fetchResultCount = 0;
_.each(this.searchCollection.models, function(model) { _.each(this.searchCollection.models, function(model) {
var modelJSON = model.toJSON(); var modelJSON = model.toJSON();
var guid = ""; var guid = "";
...@@ -320,26 +330,36 @@ define(['require', ...@@ -320,26 +330,36 @@ define(['require',
}); });
if (guid.length) { if (guid.length) {
idFound = true; idFound = true;
++fetchResultCount;
model.getEntity(guid, { model.getEntity(guid, {
async: false,
success: function(data) { success: function(data) {
if (data.definition) { if (data.definition) {
if (data.definition.id && data.definition.values) { if (data.definition.id && data.definition.values) {
that.searchCollection.get(data.definition.id).set(data.definition.values); var id = "";
that.searchCollection.get(data.definition.id).set('$id$', data.definition.id); if (_.isObject(data.definition.id) && data.definition.id.id) {
that.searchCollection.get(data.definition.id).set('$traits$', data.definition.traits); id = data.definition.id.id;
} else {
id = data.definition.id;
}
that.searchCollection.get(id).set(data.definition.values);
that.searchCollection.get(id).set('$id$', data.definition.id);
that.searchCollection.get(id).set('$traits$', data.definition.traits);
} }
} }
}, },
error: function(error, data, status) {}, error: function(error, data, status) {},
complete: function() {} complete: function() {
--fetchResultCount;
if (fetchResultCount === 0) {
that.renderTableLayoutView(that.getFixedDslColumn())
}
}
}); });
} }
}); });
if (idFound) { if (idFound === false) {
return this.getFixedDslColumn(); that.renderTableLayoutView(this.getDaynamicColumn())
} else {
return this.getDaynamicColumn();
} }
} }
} }
...@@ -371,11 +391,16 @@ define(['require', ...@@ -371,11 +391,16 @@ define(['require',
var that = this, var that = this,
nameCheck = 0, nameCheck = 0,
col = {}; col = {};
this.searchCollection.each(function(model) { for (var i = 0; i < this.searchCollection.models.length; i++) {
if (model.get('name') || model.get('qualifiedName')) { var model = this.searchCollection.models[i];
if (model && (model.get('name') || model.get('qualifiedName'))) {
++nameCheck ++nameCheck
} }
}); if (model && model.get('$id$') === undefined) {
i = i - 1;
that.searchCollection.remove(model);
}
}
if (Globals.taxonomy) { if (Globals.taxonomy) {
col['Check'] = { col['Check'] = {
name: "selected", name: "selected",
...@@ -542,7 +567,7 @@ define(['require', ...@@ -542,7 +567,7 @@ define(['require',
var view = new AddTermToEntityLayoutView({ var view = new AddTermToEntityLayoutView({
guid: guid, guid: guid,
multiple: multiple, multiple: multiple,
callback: function(termName) { callback: function() {
that.fetchCollection(); that.fetchCollection();
that.arr = []; that.arr = [];
}, },
......
...@@ -77,7 +77,7 @@ define(['require', ...@@ -77,7 +77,7 @@ define(['require',
var str = '', var str = '',
that = this; that = this;
this.ui.parentTag.empty(); this.ui.parentTag.empty();
this.tagCollection.each(function(val) { this.tagCollection.fullCollection.each(function(val) {
str += '<option>' + val.get("tags") + '</option>'; str += '<option>' + val.get("tags") + '</option>';
}); });
that.ui.parentTag.html(str); that.ui.parentTag.html(str);
......
...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES: ...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
ALL CHANGES: ALL CHANGES:
ATLAS-1091 Improvement in DSL search functionality. (kevalbhatt)
ATLAS-1080 Regression - UI - hive_storagedesc is shown as "undefined" in UI.(kevalbhatt) ATLAS-1080 Regression - UI - hive_storagedesc is shown as "undefined" in UI.(kevalbhatt)
ATLAS-1089 Storm hook should handle cyclic references in topology object (mneethiraj via sumasai) ATLAS-1089 Storm hook should handle cyclic references in topology object (mneethiraj via sumasai)
ATLAS-1086 Build failure in hive-bridge after security fixes in ATLAS-762 (sumasai) ATLAS-1086 Build failure in hive-bridge after security fixes in ATLAS-762 (sumasai)
......
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