diff --git a/dashboardv2/public/css/scss/override.scss b/dashboardv2/public/css/scss/override.scss index 89c12ca7d..48ab1a661 100644 --- a/dashboardv2/public/css/scss/override.scss +++ b/dashboardv2/public/css/scss/override.scss @@ -255,3 +255,8 @@ .ui-pnotify-text { word-break: break-all; } + +.advancedInfo{ + margin-left: 5px; + cursor: pointer; +} \ No newline at end of file diff --git a/dashboardv2/public/css/scss/search.scss b/dashboardv2/public/css/scss/search.scss index a7549243f..8c3dbec6b 100644 --- a/dashboardv2/public/css/scss/search.scss +++ b/dashboardv2/public/css/scss/search.scss @@ -19,68 +19,65 @@ //colors $color_celeste_approx: #1D1F2B; $switchTransition: .4s ease-out; - @mixin transition($transition...) { - -webkit-transition: $transition; - -moz-transition: $transition; - -o-transition: $transition; - transition: $transition; + -webkit-transition: $transition; + -moz-transition: $transition; + -o-transition: $transition; + transition: $transition; } @mixin transition-property($properties...) { - -webkit-transition-property: $properties; - -moz-transition-property: $properties; - -o-transition-property: $properties; - transition-property: $properties; + -webkit-transition-property: $properties; + -moz-transition-property: $properties; + -o-transition-property: $properties; + transition-property: $properties; } .switch { - position: relative; - width: 50px; - height: 22px; - margin-left: 8px; - padding: 3px; - vertical-align: top; - background-color: $color_celeste_approx; - border-radius: 18px; - cursor: pointer; + position: relative; + width: 50px; + height: 22px; + margin-left: 8px; + padding: 3px; + vertical-align: top; + background-color: $color_celeste_approx; + border-radius: 18px; + cursor: pointer; } .switch-input { - position: absolute; - top: 0; - left: 0; - opacity: 0; + position: absolute; + top: 0; + left: 0; + opacity: 0; } .switch-slider { - position: absolute; - top: 1px; - left: 3px; - width: 16px; - height: 16px; - border-radius: 10px; - box-shadow: 1px 1px 5px rgba(black, .2); - @include transition(left #{$switchTransition}); - - &:before { - content: ''; position: absolute; - top: 50%; - left: 50%; - margin: -6px 0 0 -8px; + top: 1px; + left: 3px; width: 16px; height: 16px; - background-color: $color_jungle_green_approx; border-radius: 10px; - box-shadow: inset 0 1px rgba(black, .02); - @include transition(inherit) - } - - .switch-input:checked ~ & { - left: 30px; - box-shadow: -1px 1px 5px rgba(black, .2); - } + box-shadow: 1px 1px 5px rgba(black, .2); + @include transition(left #{$switchTransition}); + &:before { + content: ''; + position: absolute; + top: 50%; + left: 50%; + margin: -6px 0 0 -8px; + width: 16px; + height: 16px; + background-color: $color_jungle_green_approx; + border-radius: 10px; + box-shadow: inset 0 1px rgba(black, .02); + @include transition(inherit) + } + .switch-input:checked ~ & { + left: 30px; + box-shadow: -1px 1px 5px rgba(black, .2); + } } .advanceSearchBtn { @@ -109,3 +106,11 @@ $switchTransition: .4s ease-out; .btnAssign { margin-bottom: 15px; } + +.srchType { + margin: 5px 0px; + .srchTitle { + font-size: 14px; + color: $gray + } +} diff --git a/dashboardv2/public/js/collection/VSearchList.js b/dashboardv2/public/js/collection/VSearchList.js index 60fe8fb29..6a8494314 100644 --- a/dashboardv2/public/js/collection/VSearchList.js +++ b/dashboardv2/public/js/collection/VSearchList.js @@ -37,11 +37,7 @@ define(['require', parseRecords: function(resp, options) { this.queryType = resp.queryType; this.queryText = resp.queryText; - if (resp.queryType && resp.queryType == "DSL") { - return resp.entities ? resp.entities : []; - } else { - return resp.fullTextResult ? resp.fullTextResult : []; - } + return resp.entities ? resp.entities : []; }, }, //Static Class Members diff --git a/dashboardv2/public/js/router/Router.js b/dashboardv2/public/js/router/Router.js index 799cbc79a..f68927e88 100644 --- a/dashboardv2/public/js/router/Router.js +++ b/dashboardv2/public/js/router/Router.js @@ -29,7 +29,7 @@ define([ var AppRouter = Backbone.Router.extend({ routes: { // Define some URL routes - '': 'commonAction', + '': 'defaultAction', '!/': 'tagAttributePageLoad', '!/tag/tagAttribute/(*name)': 'tagAttributePageLoad', '!/taxonomy/detailCatalog/(*url)': 'detailCatalog', @@ -243,31 +243,20 @@ define([ 'value': paramObj, 'entityDefCollection': that.entityDefCollection, 'typeHeaders': that.typeHeaders, - 'initialView': paramObj.query.trim().length === 0 + 'initialView': (paramObj.query.trim() || paramObj.type || (paramObj.dslChecked == "true" ? "" : paramObj.tag)).length === 0 })); }); }, defaultAction: function(actions) { // We have no matching route, lets just log what the URL was - if (Globals.taxonomy) { - Utils.setUrl({ - url: '#!/taxonomy', - mergeBrowserUrl: false, - updateTabState: function() { - return { taxonomyUrl: this.url, stateChanged: false }; - }, - trigger: true - }); - } else { - Utils.setUrl({ - url: '#!/tag', - mergeBrowserUrl: false, - updateTabState: function() { - return { tagUrl: this.url, stateChanged: false }; - }, - trigger: true - }); - } + Utils.setUrl({ + url: '#!/search', + mergeBrowserUrl: false, + updateTabState: function() { + return { searchUrl: this.url, stateChanged: false }; + }, + trigger: true + }); console.log('No route:', actions); } diff --git a/dashboardv2/public/js/templates/business_catalog/SideNavLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/SideNavLayoutView_tmpl.html index 38f76fffc..3f4c11ad9 100644 --- a/dashboardv2/public/js/templates/business_catalog/SideNavLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/business_catalog/SideNavLayoutView_tmpl.html @@ -19,11 +19,11 @@ Apache Atlas
diff --git a/dashboardv2/public/js/templates/search/AdvancedSearchInfo_tmpl.html b/dashboardv2/public/js/templates/search/AdvancedSearchInfo_tmpl.html new file mode 100644 index 000000000..9b8e1bc53 --- /dev/null +++ b/dashboardv2/public/js/templates/search/AdvancedSearchInfo_tmpl.html @@ -0,0 +1,38 @@ + +
+

Use DSL (Doamin Specific Language) to build queries

+ + + + + +
diff --git a/dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html b/dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html index 5ccfe18a8..a766cdf7a 100644 --- a/dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html @@ -17,29 +17,41 @@
-
- Text +
+ Basic - DSL + Advanced +
-
+
-
- +
+ Search By Type +
+ +
-
- +
+ Search By Tag +
+ +
+
+
+ Search By Query +
Clear
+
diff --git a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html index eece7d2ab..f51ea0a77 100644 --- a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html @@ -34,9 +34,9 @@
{{#if entityCreate}} {{/if}} diff --git a/dashboardv2/public/js/utils/Enums.js b/dashboardv2/public/js/utils/Enums.js index 4948dcc28..c779cd4cb 100644 --- a/dashboardv2/public/js/utils/Enums.js +++ b/dashboardv2/public/js/utils/Enums.js @@ -44,7 +44,7 @@ define(['require'], function(require) { Enums.searchUrlType = { DSL: 'dsl', - FULLTEXT: 'fulltext' + FULLTEXT: 'basic' } return Enums; diff --git a/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js b/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js index d92a0e84d..b2c144c41 100644 --- a/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js +++ b/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js @@ -111,13 +111,13 @@ define(['require', }); }, selectTab: function() { - if (Utils.getUrlState.isTagTab() || (Utils.getUrlState.isInitial() && !Globals.taxonomy)) { + if (Utils.getUrlState.isTagTab()) { this.$('.tabs').find('li a[aria-controls="tab-tag"]').parents('li').addClass('active').siblings().removeClass('active'); this.$('.tab-content').find('div#tab-tag').addClass('active').siblings().removeClass('active'); - } else if (Utils.getUrlState.isTaxonomyTab() || (Utils.getUrlState.isInitial() && Globals.taxonomy)) { + } else if (Utils.getUrlState.isTaxonomyTab()) { this.$('.tabs').find('li a[aria-controls="tab-taxonomy"]').parents('li').addClass('active').siblings().removeClass('active'); this.$('.tab-content').find('div#tab-taxonomy').addClass('active').siblings().removeClass('active'); - } else if (Utils.getUrlState.isSearchTab() || (Utils.getUrlState.isDetailPage())) { + } else if (Utils.getUrlState.isSearchTab() || (Utils.getUrlState.isDetailPage()) || Utils.getUrlState.isInitial()) { this.$('.tabs').find('li a[aria-controls="tab-search"]').parents('li').addClass('active').siblings().removeClass('active'); this.$('.tab-content').find('div#tab-search').addClass('active').siblings().removeClass('active'); } diff --git a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js b/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js index 7c8eb2309..0bca0df73 100644 --- a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js +++ b/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js @@ -338,7 +338,7 @@ define(['require', var dataURL = this.$('.taxonomyTree').find('li[data-id="Parent"]').find("a").data('href'); if (dataURL) { this.url = dataURL; - if (this.viewBased) { + if (this.viewBased && Utils.getUrlState.isTaxonomyTab()) { Utils.setUrl({ url: "#!/taxonomy/detailCatalog" + dataURL, mergeBrowserUrl: false, diff --git a/dashboardv2/public/js/views/search/AdvancedSearchInfoView.js b/dashboardv2/public/js/views/search/AdvancedSearchInfoView.js new file mode 100644 index 000000000..44319ec74 --- /dev/null +++ b/dashboardv2/public/js/views/search/AdvancedSearchInfoView.js @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +define(['require', + 'backbone', + 'hbs!tmpl/search/AdvancedSearchInfo_tmpl', +], function(require, Backbone, AdvancedSearchInfoTmpl) { + + var AdvancedSearchInfoView = Backbone.Marionette.LayoutView.extend( + /** @lends AdvancedSearchInfoView */ + { + _viewName: 'AdvancedSearchInfoView', + + template: AdvancedSearchInfoTmpl, + + + + /** Layout sub regions */ + regions: {}, + + + /** ui selector cache */ + ui: { + + }, + /** ui events hash */ + events: function() { + var events = {}; + return events; + }, + /** + * intialize a new AdvancedSearchInfoView Layout + * @constructs + */ + initialize: function(options) { + + }, + bindEvents: function() {}, + onRender: function() { + + }, + + + }); + return AdvancedSearchInfoView; +}); diff --git a/dashboardv2/public/js/views/search/SearchDetailLayoutView.js b/dashboardv2/public/js/views/search/SearchDetailLayoutView.js index 73bbb9732..c24f7a493 100644 --- a/dashboardv2/public/js/views/search/SearchDetailLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchDetailLayoutView.js @@ -53,16 +53,10 @@ define(['require', var that = this; require(['views/search/SearchResultLayoutView'], function(SearchResultLayoutView) { - var value = {}; - if (that.value) { - value = { - 'query': that.value.query, - 'searchType': that.value.searchType - }; - } + if (that.RSearchResultLayoutView) { that.RSearchResultLayoutView.show(new SearchResultLayoutView({ - value: value, + value: that.value, tag: that.tag, initialView: that.initialView, entityDefCollection: that.entityDefCollection, diff --git a/dashboardv2/public/js/views/search/SearchLayoutView.js b/dashboardv2/public/js/views/search/SearchLayoutView.js index df7e448de..d3a90305e 100644 --- a/dashboardv2/public/js/views/search/SearchLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchLayoutView.js @@ -42,7 +42,9 @@ define(['require', searchBtn: '[data-id="searchBtn"]', clearSearch: '[data-id="clearSearch"]', typeLov: '[data-id="typeLOV"]', - refreshBtn: '[data-id="refreshBtn"]' + tagLov: '[data-id="tagLOV"]', + refreshBtn: '[data-id="refreshBtn"]', + advancedInfoBtn: '[data-id="advancedInfo"]' }, /** ui events hash */ @@ -51,19 +53,18 @@ define(['require', that = this; events["keyup " + this.ui.searchInput] = function(e) { var code = e.which; - this.ui.searchBtn.removeAttr("disabled"); if (code == 13) { that.findSearchResult(); } - if (code == 8 && this.ui.searchInput.val() == "" && this.ui.typeLov.val() == "") { - this.ui.searchBtn.attr("disabled", "true"); - } + this.checkForButtonVisiblity(); }; events["change " + this.ui.searchType] = 'dslFulltextToggle'; events["click " + this.ui.searchBtn] = 'findSearchResult'; events["click " + this.ui.clearSearch] = 'clearSearchData'; - events["change " + this.ui.typeLov] = 'onChangeTypeList'; + events["change " + this.ui.typeLov] = 'checkForButtonVisiblity'; + events["change " + this.ui.tagLov] = 'checkForButtonVisiblity'; events["click " + this.ui.refreshBtn] = 'onRefreshButton'; + events["click " + this.ui.advancedInfoBtn] = 'advancedInfo'; return events; }, /** @@ -72,42 +73,68 @@ define(['require', */ initialize: function(options) { _.extend(this, _.pick(options, 'value', 'typeHeaders')); - this.type = "fulltext"; + this.type = "basic"; var param = Utils.getUrlState.getQueryParams(); this.query = { dsl: { - query: "" + query: "", + type: "" }, - fulltext: { - query: "" + basic: { + query: "", + type: "", + tag: "" } }; this.dsl = false; - if (param && param.query && param.searchType) { - this.query[param.searchType].query = param.query; + if (param && param.searchType) { + _.extend(this.query[param.searchType], _.pick(param, 'query', 'type', 'tag')); } }, bindEvents: function(param) { this.listenTo(this.typeHeaders, "reset", function(value) { - this.renderTypeList(); + this.renderTypeTagList(); this.setValues(); this.ui.typeLov.select2({ - placeholder: "Search For", + placeholder: "Select", allowClear: true }); + this.ui.tagLov.select2({ + placeholder: "Select", + allowClear: true + }); + this.checkForButtonVisiblity(); }, this); }, + checkForButtonVisiblity: function() { + var that = this, + value = this.ui.searchInput.val() || this.ui.typeLov.val(); + if (!this.dsl && !value.length) { + value = this.ui.tagLov.val(); + } + if (value && value.length) { + this.ui.searchBtn.removeAttr("disabled"); + setTimeout(function() { + that.ui.searchInput.focus(); + }, 0); + } else { + this.ui.searchBtn.attr("disabled", "true"); + } + }, onRender: function() { // array of tags which is coming from url - this.$('.typeLOV').hide(); - this.renderTypeList(); + this.renderTypeTagList(); this.setValues(); this.ui.typeLov.select2({ - placeholder: "Search For", + placeholder: "Select", + allowClear: true + }); + this.ui.tagLov.select2({ + placeholder: "Select", allowClear: true }); - this.ui.searchBtn.attr("disabled", "true"); this.bindEvents(); + this.checkForButtonVisiblity(); }, fetchCollection: function(value) { this.typeHeaders.fetch({ reset: true }); @@ -115,33 +142,45 @@ define(['require', onRefreshButton: function() { this.fetchCollection(); }, + advancedInfo: function(e) { + require([ + 'views/search/AdvancedSearchInfoView', + 'modules/Modal' + ], function(AdvancedSearchInfoView, Modal) { + var view = new AdvancedSearchInfoView(); + var modal = new Modal({ + title: 'Advanced Search Queries', + content: view, + okCloses: true, + showFooter: true, + allowCancel: false + }).open(); + view.on('closeModal', function() { + modal.trigger('cancel'); + }); + }); + }, manualRender: function(paramObj) { this.setValues(paramObj); }, - renderTypeList: function() { + renderTypeTagList: function() { var that = this; this.ui.typeLov.empty(); - var str = ''; + var typeStr = '', + tagStr = typeStr; this.typeHeaders.fullCollection.comparator = function(model) { return Utils.getName(model.toJSON(), 'name').toLowerCase(); } this.typeHeaders.fullCollection.sort().each(function(model) { if (model.get('category') == 'ENTITY') { - str += ''; + typeStr += ''; + } + if (model.get('category') == 'CLASSIFICATION') { + tagStr += ''; } }); - that.ui.typeLov.html(str); - }, - onChangeTypeList: function(e) { - var that = this; - if (this.ui.typeLov.select2('val') !== "") { - this.ui.searchBtn.removeAttr("disabled"); - } else if (this.ui.searchInput.val() === "") { - this.ui.searchBtn.attr("disabled", "true"); - } - setTimeout(function() { - that.ui.searchInput.focus(); - }, 0); + that.ui.typeLov.html(typeStr); + that.ui.tagLov.html(tagStr); }, setValues: function(paramObj) { var arr = [], @@ -157,56 +196,42 @@ define(['require', } 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); - setTimeout(function() { - that.ui.searchInput.focus(); - }, 0); - } - this.ui.searchInput.val(query.join(" ")); + + if (this.ui.typeLov.data('select2')) { + this.ui.typeLov.val(this.value.type).trigger('change'); } else { - this.ui.searchInput.val(this.value.query); - setTimeout(function() { - that.ui.searchInput.focus(); - }, 0); + this.ui.typeLov.val(this.value.type); } - if (this.ui.searchBtn.val() !== "" || this.ui.typeLov.val() !== "") { - this.ui.searchBtn.removeAttr("disabled"); + if (!this.dsl) { + if (this.ui.tagLov.data('select2')) { + this.ui.tagLov.val(this.value.tag).trigger('change'); + } else { + this.ui.tagLov.val(this.value.tag); + } } + this.ui.searchInput.val(this.value.query); + setTimeout(function() { + that.ui.searchInput.focus(); + }, 0); } } - this.bindEvents(arr); }, findSearchResult: function() { this.triggerSearch(this.ui.searchInput.val()); }, triggerSearch: function(value) { - if (this.ui.searchType.is(':checked')) { - this.type = "dsl"; - } else if (!this.ui.searchType.is(':checked')) { - this.type = "fulltext"; - } - if (this.ui.typeLov.select2('val') !== null && this.dsl === true) { - this.query[this.type].query = this.ui.typeLov.select2('val') + ' ' + value; - } else { - this.query[this.type].query = value + this.query[this.type].query = value; + this.query[this.type].type = this.ui.typeLov.select2('val'); + if (!this.dsl) { + this.query[this.type].tag = this.ui.tagLov.select2('val'); } + Utils.setUrl({ url: '#!/search/searchResult', - urlParams: { - query: this.query[this.type].query, + urlParams: _.extend(this.query[this.type], { searchType: this.type, dslChecked: this.ui.searchType.is(':checked') - }, + }), updateTabState: function() { return { searchUrl: this.url, stateChanged: true }; }, @@ -219,35 +244,34 @@ define(['require', if (e.currentTarget.checked) { this.type = "dsl"; this.dsl = true; - this.$('.typeLOV').show(); + this.$('.tagBox').hide(); } else { + this.$('.tagBox').show(); this.dsl = false; - this.$('.typeLOV').hide(); - this.type = "fulltext"; + this.type = "basic"; } if (Utils.getUrlState.getQueryParams() && this.query[this.type].query !== Utils.getUrlState.getQueryParams().query && this.type == Utils.getUrlState.getQueryParams().searchType) { this.query[this.type].query = Utils.getUrlState.getQueryParams().query; } Utils.setUrl({ url: '#!/search/searchResult', - urlParams: { - query: this.query[this.type].query, + urlParams: _.extend(this.query[this.type], { searchType: this.type, dslChecked: this.ui.searchType.is(':checked') - }, + }), updateTabState: function() { return { searchUrl: this.url, stateChanged: true }; }, mergeBrowserUrl: false, trigger: true }); - this.ui.searchInput.attr("placeholder", this.type == "dsl" ? 'Optional conditions' : 'Search using a query string: e.g. sales_fact'); }, clearSearchData: function() { this.query[this.type].query = ""; this.ui.typeLov.val("").trigger("change"); + this.ui.tagLov.val("").trigger("change"); this.ui.searchInput.val(""); - this.ui.searchBtn.attr("disabled", "true"); + this.checkForButtonVisiblity() Utils.setUrl({ url: '#!/search', mergeBrowserUrl: false, diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js index 8dce5bec7..46c3229e3 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -63,7 +63,8 @@ define(['require', }, templateHelpers: function() { return { - entityCreate: Globals.entityCreate + entityCreate: Globals.entityCreate, + searchType: this.searchType }; }, /** ui events hash */ @@ -147,6 +148,10 @@ define(['require', this.bindEvents(); this.bradCrumbList = []; this.arr = []; + this.searchType = 'Basic Search'; + if (this.value && this.value.searchType && this.value.searchType == 'dsl') { + this.searchType = 'Advanced Search'; + } }, bindEvents: function() { var that = this; @@ -160,11 +165,7 @@ define(['require', this.searchCollection.find(function(item) { if (item.get('isEnable')) { var term = []; - if (that.searchCollection.queryType == "DSL") { - var obj = item.toJSON(); - } else { - var obj = item.get('entity'); - } + var obj = model.toJSON(); that.arr.push({ id: obj.guid, model: obj @@ -202,7 +203,7 @@ define(['require', } else { value = { 'query': '', - 'searchType': 'fulltext' + 'searchType': 'basic' }; } this.fetchCollection(value); @@ -223,9 +224,6 @@ define(['require', }, fetchCollection: function(value) { var that = this; - if (value && (value.query === undefined || value.query.trim() === "")) { - return; - } this.showLoader(); if (Globals.searchApiCallRef && Globals.searchApiCallRef.readyState === 1) { Globals.searchApiCallRef.abort(); @@ -240,7 +238,7 @@ define(['require', if (Utils.getUrlState.isTagTab()) { this.searchCollection.url = UrlLinks.searchApiUrl(Enums.searchUrlType.DSL); } - _.extend(this.searchCollection.queryParams, { 'query': value.query.trim() }); + _.extend(this.searchCollection.queryParams, { 'query': value.query.trim() || null, 'type': value.type || null, 'classification': value.tag || null }); } Globals.searchApiCallRef = this.searchCollection.fetch({ skipDefaultError: true, @@ -293,7 +291,7 @@ define(['require', if (Globals.taxonomy) { multiAssignDataTerm = ''; } - if (Globals.entityCreate && (resultText.indexOf("\`") != 0) && Globals.entityTypeConfList) { + if (Globals.entityCreate && Globals.entityTypeConfList) { createEntityTag = "

If you do not find the entity in search result below then you can" + ' create new entity

'; } that.$('.searchResult').html(resultData + multiAssignDataTag + multiAssignDataTerm + createEntityTag); @@ -349,14 +347,9 @@ define(['require', className: "searchTableName", formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { - if (that.searchCollection.queryType == "DSL") { - var obj = model.toJSON(); - } else { - var obj = model.get('entity'); - } - var nameHtml = ""; - - var name = Utils.getName(obj); + var obj = model.toJSON(), + nameHtml = "", + name = Utils.getName(obj); if (obj.guid) { nameHtml = '' + name + ''; } else { @@ -388,11 +381,7 @@ define(['require', sortable: false, formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { - if (that.searchCollection.queryType == "DSL") { - var obj = model.toJSON(); - } else { - var obj = model.get('entity'); - } + var obj = model.toJSON(); if (obj && obj.attributes && obj.attributes.description) { return obj.attributes.description; } @@ -406,11 +395,7 @@ define(['require', sortable: false, formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { - if (that.searchCollection.queryType == "DSL") { - var obj = model.toJSON(); - } else { - var obj = model.get('entity'); - } + var obj = model.toJSON(); if (obj && obj.typeName) { return '' + obj.typeName + ''; } @@ -424,11 +409,7 @@ define(['require', sortable: false, formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { - if (that.searchCollection.queryType == "DSL") { - var obj = model.toJSON(); - } else { - var obj = model.get('entity'); - } + var obj = model.toJSON(); if (obj && obj.attributes && obj.attributes.owner) { return obj.attributes.owner; } @@ -444,11 +425,7 @@ define(['require', className: 'searchTag', formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { - if (that.searchCollection.queryType == "DSL") { - var obj = model.toJSON(); - } else { - var obj = model.get('entity'); - } + var obj = model.toJSON(); if (obj.status && Enums.entityStateReadOnly[obj.status]) { return '
' + CommonViewFunction.tagForTable(obj); + '
'; } else { @@ -468,11 +445,7 @@ define(['require', className: 'searchTerm', formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { - if (that.searchCollection.queryType == "DSL") { - var obj = model.toJSON(); - } else { - var obj = model.get('entity'); - } + var obj = model.toJSON(); var returnObject = CommonViewFunction.termTableBreadcrumbMaker(obj); if (returnObject.object) { that.bradCrumbList.push(returnObject.object); @@ -509,21 +482,13 @@ define(['require', var that = this; if (!multiple || multiple.length === 0) { var modal = this.searchCollection.find(function(item) { - if (that.searchCollection.queryType == "DSL") { - var obj = item.toJSON(); - } else { - var obj = item.get('entity'); - } + var obj = model.toJSON(); if (obj.guid === guid) { return true; } }); if (modal) { - if (that.searchCollection.queryType == "DSL") { - var obj = modal.toJSON(); - } else { - var obj = modal.get('entity'); - } + var obj = model.toJSON(); } else { return []; } diff --git a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js index d342b968a..20da1becf 100644 --- a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js @@ -55,8 +55,7 @@ define(['require', var that = this; require(['views/search/SearchResultLayoutView'], function(SearchResultLayoutView) { var value = { - 'query': "`" + that.tag + "`", - 'type': 'dsl' + 'query': "`" + that.tag + "`" }; that.RSearchResultLayoutView.show(new SearchResultLayoutView({ value: value, diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js index 13ea0f472..e6b206557 100644 --- a/dashboardv2/public/js/views/tag/TagLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagLayoutView.js @@ -96,7 +96,7 @@ define(['require', } }, setValues: function(manual) { - if (Utils.getUrlState.isTagTab() || (Utils.getUrlState.isInitial() && !Globals.taxonomy)) { + if (Utils.getUrlState.isTagTab()) { if (!this.tag) { this.selectFirst = false; this.ui.tagsParent.find('li').first().addClass('active'); diff --git a/release-log.txt b/release-log.txt index a4c04ca0b..344f5bfe4 100644 --- a/release-log.txt +++ b/release-log.txt @@ -9,6 +9,12 @@ 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-1608 :Search UI improvement (kevalbhatt) +ATLAS-1630: basic search implementation (#2) +ATLAS-1630: basic search implementation using fulltext with support for filter by type & classification +ATLAS-1629: updated copyright date in NOTICE file +ATLAS-1627: fix for missed update to full-text index attribute on entity-update +ATLAS-1626: updated Atlas type-load to be resilient to incorrect constraints in the store (from earlier version env) ATLAS-1628 Restrict user from entering text in datepicker input (kevalbhatt) ATLAS-1538 Make AtlasLdapAuthenticationProvider like Ranger for OpenLdap type (nixonrodrigues via kevalbhatt) ATLAS-1605 Edit Entity in UI : Update button is not enabled when updating attribute of type date (Kalyanikashikar via kevalbhatt)