SearchLayoutView.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. define([ "require", "backbone", "hbs!tmpl/search/SearchLayoutView_tmpl", "utils/Utils", "utils/UrlLinks", "utils/Globals", "utils/Enums", "collection/VSearchList", "utils/CommonViewFunction", "jstree" ], function(require, Backbone, SearchLayoutViewTmpl, Utils, UrlLinks, Globals, Enums, VSearchList, CommonViewFunction) {
  2. "use strict";
  3. var SearchLayoutView = Backbone.Marionette.LayoutView.extend({
  4. _viewName: "SearchLayoutView",
  5. template: SearchLayoutViewTmpl,
  6. regions: {},
  7. ui: {
  8. searchInput: '[data-id="searchInput"]',
  9. searchType: 'input[name="queryType"]',
  10. searchBtn: '[data-id="searchBtn"]',
  11. clearSearch: '[data-id="clearSearch"]',
  12. typeLov: '[data-id="typeLOV"]',
  13. tagLov: '[data-id="tagLOV"]',
  14. termLov: '[data-id="termLOV"]',
  15. refreshBtn: '[data-id="refreshBtn"]',
  16. advancedInfoBtn: '[data-id="advancedInfo"]',
  17. typeAttrFilter: '[data-id="typeAttrFilter"]',
  18. tagAttrFilter: '[data-id="tagAttrFilter"]'
  19. },
  20. events: function() {
  21. var events = {}, that = this;
  22. return events["keyup " + this.ui.searchInput] = function(e) {
  23. var code = e.which;
  24. this.value.query = e.currentTarget.value, this.query[this.type].query = this.value.query,
  25. 13 == code && that.findSearchResult(), this.checkForButtonVisiblity();
  26. }, events["change " + this.ui.searchType] = "dslFulltextToggle", events["click " + this.ui.searchBtn] = "findSearchResult",
  27. events["click " + this.ui.clearSearch] = "clearSearchData", events["change " + this.ui.typeLov] = "checkForButtonVisiblity",
  28. events["change " + this.ui.tagLov] = "checkForButtonVisiblity", events["change " + this.ui.termLov] = "checkForButtonVisiblity",
  29. events["click " + this.ui.refreshBtn] = "onRefreshButton", events["click " + this.ui.advancedInfoBtn] = "advancedInfo",
  30. events["click " + this.ui.typeAttrFilter] = function() {
  31. this.openAttrFilter("type");
  32. }, events["click " + this.ui.tagAttrFilter] = function() {
  33. this.openAttrFilter("tag");
  34. }, events;
  35. },
  36. initialize: function(options) {
  37. _.extend(this, _.pick(options, "value", "typeHeaders", "searchVent", "entityDefCollection", "enumDefCollection", "classificationDefCollection", "searchTableColumns", "searchTableFilters", "metricCollection", "onSubmit")),
  38. this.type = "dsl", this.entityCountObj = _.first(this.metricCollection.toJSON()) || {
  39. entity: {
  40. entityActive: {},
  41. entityDeleted: {}
  42. },
  43. tag: {
  44. tagEntities: {}
  45. }
  46. }, this.filterTypeSelected = [];
  47. var param = Utils.getUrlState.getQueryParams();
  48. this.query = {
  49. dsl: {
  50. query: null,
  51. type: null,
  52. pageOffset: null,
  53. pageLimit: null
  54. },
  55. basic: {
  56. query: null,
  57. type: null,
  58. tag: null,
  59. term: null,
  60. attributes: null,
  61. tagFilters: null,
  62. pageOffset: null,
  63. pageLimit: null,
  64. entityFilters: null,
  65. includeDE: null,
  66. excludeST: null,
  67. excludeSC: null
  68. }
  69. }, this.value || (this.value = {}), this.dsl = !1, param && param.searchType && (this.type = param.searchType,
  70. this.updateQueryObject(param)), this.bindEvents();
  71. },
  72. bindEvents: function(param) {
  73. this.listenTo(this.typeHeaders, "reset", function(value) {
  74. this.initializeValues();
  75. }, this);
  76. },
  77. onRender: function() {
  78. "basic" === this.type && this.$(".searchByText").hide(), this.initializeValues(),
  79. this.dslFulltextToggle(!0, !1);
  80. },
  81. initializeValues: function() {
  82. this.renderTypeTagList(), this.renderTermList(), this.setValues(), this.checkForButtonVisiblity();
  83. },
  84. makeFilterButtonActive: function(filtertypeParam) {
  85. var filtertype = [ "entityFilters", "tagFilters" ], that = this;
  86. filtertypeParam && (_.isArray(filtertypeParam) ? filtertype = filtertypeParam : _.isString(filtertypeParam) && (filtertype = [ filtertypeParam ]));
  87. var typeCheck = function(filterObj, type) {
  88. that.value.type ? (filterObj && filterObj.length ? that.ui.typeAttrFilter.addClass("active") : that.ui.typeAttrFilter.removeClass("active"),
  89. that.ui.typeAttrFilter.prop("disabled", !1)) : (that.ui.typeAttrFilter.removeClass("active"),
  90. that.ui.typeAttrFilter.prop("disabled", !0));
  91. }, tagCheck = function(filterObj, type) {
  92. that.value.tag && !_.contains(Enums.addOnClassification, that.value.tag) ? (that.ui.tagAttrFilter.prop("disabled", !1),
  93. filterObj && filterObj.length ? that.ui.tagAttrFilter.addClass("active") : that.ui.tagAttrFilter.removeClass("active")) : (that.ui.tagAttrFilter.removeClass("active"),
  94. that.ui.tagAttrFilter.prop("disabled", !0));
  95. };
  96. _.each(filtertype, function(type) {
  97. var filterObj = that.searchTableFilters[type];
  98. "entityFilters" == type && typeCheck(filterObj[that.value.type], type), "tagFilters" == type && tagCheck(filterObj[that.value.tag], type);
  99. });
  100. },
  101. checkForButtonVisiblity: function(e, options) {
  102. var that = this, isBasicSearch = "basic" == this.type;
  103. if (e && e.currentTarget) {
  104. var $el = $(e.currentTarget), isTagEl = "tagLOV" == $el.data("id"), isTermEl = "termLOV" == $el.data("id"), isTypeEl = "typeLOV" == $el.data("id"), select2Data = $el.select2("data");
  105. if ("change" == e.type && select2Data) {
  106. var value = _.isEmpty(select2Data) ? select2Data : _.first(select2Data).id, key = "tag", filterType = isBasicSearch ? "tagFilters" : null, value = value && value.length ? value : null;
  107. if (isTagEl || (key = isTermEl ? "term" : "type", isBasicSearch && (filterType = isTypeEl ? "entityFilters" : null)),
  108. this.value) {
  109. if (this.value[key] !== value || !value && !this.value[key]) {
  110. var temp = {};
  111. temp[key] = value, _.extend(this.value, temp), _.isUndefined(options) && (this.value.pageOffset = 0),
  112. _.extend(this.query[this.type], temp);
  113. } else if (isBasicSearch && this.value.type) if (this.value.attributes) {
  114. var attributes = _.sortBy(this.value.attributes.split(",")), tableColumn = this.searchTableColumns[this.value.type];
  115. _.isEmpty(this.searchTableColumns) || !tableColumn ? this.searchTableColumns[this.value.type] = attributes : tableColumn.join(",") !== attributes.join(",") && (this.searchTableColumns[this.value.type] = attributes);
  116. } else this.searchTableColumns[this.value.type] && (this.searchTableColumns[this.value.type] = void 0);
  117. isBasicSearch && filterType && this.makeFilterButtonActive(filterType);
  118. } else isBasicSearch && (this.ui.tagAttrFilter.prop("disabled", !0), this.ui.typeAttrFilter.prop("disabled", !0));
  119. }
  120. }
  121. var value = this.ui.searchInput.val() || _.first($(this.ui.typeLov).select2("data")).id;
  122. if (!this.dsl && _.isEmpty(value)) {
  123. var termData = _.first($(this.ui.termLov).select2("data"));
  124. value = _.first($(this.ui.tagLov).select2("data")).id || (termData ? termData.id : "");
  125. }
  126. value && value.length ? (this.ui.searchBtn.removeAttr("disabled"), setTimeout(function() {
  127. !that.isDestroyed && that.ui.searchInput.focus();
  128. }, 0)) : this.ui.searchBtn.attr("disabled", "true");
  129. },
  130. updateQueryObject: function(param) {
  131. param && param.searchType && (this.type = param.searchType), _.extend(this.query[this.type], "dsl" == this.type ? {
  132. query: null,
  133. type: null,
  134. pageOffset: null,
  135. pageLimit: null
  136. } : {
  137. query: null,
  138. type: null,
  139. tag: null,
  140. term: null,
  141. attributes: null,
  142. tagFilters: null,
  143. pageOffset: null,
  144. pageLimit: null,
  145. entityFilters: null,
  146. includeDE: null
  147. }, param);
  148. },
  149. fetchCollection: function(value) {
  150. this.typeHeaders.fetch({
  151. reset: !0
  152. });
  153. },
  154. onRefreshButton: function() {
  155. this.fetchCollection();
  156. var checkURLValue = Utils.getUrlState.getQueryParams(this.url);
  157. this.searchVent && (_.has(checkURLValue, "tag") || _.has(checkURLValue, "type") || _.has(checkURLValue, "query")) && this.searchVent.trigger("search:refresh");
  158. },
  159. advancedInfo: function(e) {
  160. require([ "views/search/AdvancedSearchInfoView", "modules/Modal" ], function(AdvancedSearchInfoView, Modal) {
  161. var view = new AdvancedSearchInfoView(), modal = new Modal({
  162. title: "高级搜索查询",
  163. content: view,
  164. okCloses: !0,
  165. showFooter: !0,
  166. allowCancel: !1
  167. }).open();
  168. view.on("closeModal", function() {
  169. modal.trigger("cancel");
  170. });
  171. });
  172. },
  173. openAttrFilter: function(filterType) {
  174. var that = this;
  175. require([ "views/search/SearchQueryView" ], function(SearchQueryView) {
  176. that.attrModal = new SearchQueryView({
  177. value: that.value,
  178. tag: "tag" === filterType,
  179. type: "type" === filterType,
  180. searchVent: that.searchVent,
  181. typeHeaders: that.typeHeaders,
  182. entityDefCollection: that.entityDefCollection,
  183. enumDefCollection: that.enumDefCollection,
  184. classificationDefCollection: that.classificationDefCollection,
  185. searchTableFilters: that.searchTableFilters
  186. }), that.attrModal.on("ok", function(scope, e) {
  187. that.okAttrFilterButton(e);
  188. });
  189. });
  190. },
  191. okAttrFilterButton: function(e) {
  192. function getIdFromRuleObject(rule) {
  193. return _.map(rule.rules, function(obj, key) {
  194. return _.has(obj, "condition") ? getIdFromRuleObject(obj) : col.push(obj.id);
  195. }), col;
  196. }
  197. var isTag = !!this.attrModal.tag, filtertype = isTag ? "tagFilters" : "entityFilters", queryBuilderRef = this.attrModal.RQueryBuilder.currentView.ui.builder, col = [];
  198. if (queryBuilderRef.data("queryBuilder")) var rule = queryBuilderRef.queryBuilder("getRules");
  199. if (rule) {
  200. var ruleUrl = CommonViewFunction.attributeFilter.generateUrl({
  201. value: rule,
  202. formatedDateToLong: !0
  203. });
  204. this.searchTableFilters[filtertype][isTag ? this.value.tag : this.value.type] = ruleUrl,
  205. this.makeFilterButtonActive(filtertype), !isTag && this.value && this.value.type && this.searchTableColumns && (this.searchTableColumns[this.value.type] || (this.searchTableColumns[this.value.type] = [ "selected", "name", "owner", "description", "tag", "typeName" ]),
  206. this.searchTableColumns[this.value.type] = _.sortBy(_.union(this.searchTableColumns[this.value.type], getIdFromRuleObject(rule)))),
  207. this.attrModal.modal.close(), $(e.currentTarget).hasClass("search") && this.findSearchResult();
  208. }
  209. },
  210. manualRender: function(paramObj) {
  211. this.updateQueryObject(paramObj), this.setValues(paramObj);
  212. },
  213. getFilterBox: function() {
  214. var serviceStr = "", serviceArr = [], that = this;
  215. this.typeHeaders.fullCollection.each(function(model) {
  216. var serviceType = model.toJSON().serviceType;
  217. serviceType && serviceArr.push(serviceType);
  218. }), _.each(_.uniq(serviceArr), function(service) {
  219. serviceStr += '<li><div class="pretty p-switch p-fill"><input type="checkbox" class="pull-left" data-value="' + service + '" value="" ' + (_.contains(that.filterTypeSelected, service) ? "checked" : "") + '/><div class="state p-primary"><label>' + service.toUpperCase() + "</label></div></div></li>";
  220. });
  221. var templt = serviceStr + '<hr class="hr-filter"/><div class="text-right"><div class="divider"></div><button class="btn btn-action btn-sm filterDone">Done</button></div>';
  222. return templt;
  223. },
  224. setValues: function(paramObj) {
  225. var that = this;
  226. paramObj && (this.value = paramObj), this.value && (this.ui.searchInput.val(this.value.query || ""),
  227. "true" == this.value.dslChecked ? this.ui.searchType.prop("checked") || this.ui.searchType.prop("checked", !0).trigger("change") : this.ui.searchType.prop("checked") && this.ui.searchType.prop("checked", !1).trigger("change"),
  228. this.ui.typeLov.val(this.value.type), this.ui.typeLov.data("select2") && (this.ui.typeLov.val() !== this.value.type ? (this.value.type = null,
  229. this.ui.typeLov.val("").trigger("change", {
  230. manual: !0
  231. })) : this.ui.typeLov.trigger("change", {
  232. manual: !0
  233. })), this.dsl || (this.ui.tagLov.val(this.value.tag), this.ui.tagLov.data("select2") && (this.ui.tagLov.val() !== this.value.tag ? (this.value.tag = null,
  234. this.ui.tagLov.val("").trigger("change", {
  235. manual: !0
  236. })) : this.ui.tagLov.trigger("change", {
  237. manual: !0
  238. })), this.value.term && this.ui.termLov.append('<option value="' + this.value.term + '" selected="selected">' + this.value.term + "</option>"),
  239. this.ui.termLov.data("select2") && (this.ui.termLov.val() !== this.value.term ? (this.value.term = null,
  240. this.ui.termLov.val("").trigger("change", {
  241. manual: !0
  242. })) : this.ui.termLov.trigger("change", {
  243. manual: !0
  244. }))), setTimeout(function() {
  245. !that.isDestroyed && that.ui.searchInput.focus();
  246. }, 0));
  247. },
  248. renderTypeTagList: function(options) {
  249. var that = this, serviceTypeToBefiltered = options && options.filterList, isTypeOnly = options && options.isTypeOnly;
  250. this.ui.typeLov.empty();
  251. var typeStr = "<option></option>", tagStr = typeStr;
  252. this.typeHeaders.fullCollection.each(function(model) {
  253. var name = Utils.getName(model.toJSON(), "name");
  254. if ("ENTITY" == model.get("category") && (!serviceTypeToBefiltered || !serviceTypeToBefiltered.length || _.contains(serviceTypeToBefiltered, model.get("serviceType")))) {
  255. var entityCount = that.entityCountObj.entity.entityActive[name] + (that.entityCountObj.entity.entityDeleted[name] ? that.entityCountObj.entity.entityDeleted[name] : 0);
  256. typeStr += '<option value="' + name + '" data-name="' + name + '">' + name + " " + (entityCount ? "(" + _.numberFormatWithComma(entityCount) + ")" : "") + "</option>";
  257. }
  258. if (void 0 == isTypeOnly && "CLASSIFICATION" == model.get("category")) {
  259. var tagEntityCount = that.entityCountObj.tag.tagEntities[name];
  260. tagStr += '<option value="' + name + '" data-name="' + name + '">' + name + " " + (tagEntityCount ? "(" + _.numberFormatWithComma(tagEntityCount) + ")" : "") + "</option>";
  261. }
  262. }), _.isUndefined(isTypeOnly) && (_.each(Enums.addOnClassification, function(classificationName) {
  263. tagStr += '<option value="' + classificationName + '" data-name="' + classificationName + '">' + classificationName + "</option>";
  264. }), that.ui.tagLov.html(tagStr), this.ui.tagLov.select2({
  265. placeholder: "Select Classification",
  266. allowClear: !0
  267. })), that.ui.typeLov.html(typeStr);
  268. var typeLovSelect2 = this.ui.typeLov.select2({
  269. placeholder: "请选择类型",
  270. dropdownAdapter: $.fn.select2.amd.require("ServiceTypeFilterDropdownAdapter"),
  271. allowClear: !0,
  272. dropdownCssClass: "searchLayoutView",
  273. getFilterBox: this.getFilterBox.bind(this),
  274. onFilterSubmit: function(options) {
  275. that.filterTypeSelected = options.filterVal, that.renderTypeTagList({
  276. filterList: options.filterVal,
  277. isTypeOnly: !0
  278. });
  279. }
  280. });
  281. typeLovSelect2.on("select2:close", function() {
  282. typeLovSelect2.trigger("hideFilter");
  283. }), typeLovSelect2 && serviceTypeToBefiltered && typeLovSelect2.select2("open").trigger("change", {
  284. manual: !0
  285. });
  286. },
  287. renderTermList: function() {
  288. var getTypeAheadData = function(data, params) {
  289. var dataList = data.entities, foundOptions = [];
  290. return _.each(dataList, function(obj) {
  291. obj && (obj.guid && (obj.id = Utils.getName(obj, "qualifiedName")), foundOptions.push(obj));
  292. }), foundOptions;
  293. };
  294. this.ui.termLov.select2({
  295. placeholder: "Search Term",
  296. allowClear: !0,
  297. ajax: {
  298. url: UrlLinks.searchApiUrl("attribute"),
  299. dataType: "json",
  300. delay: 250,
  301. data: function(params) {
  302. return {
  303. attrValuePrefix: params.term,
  304. typeName: "AtlasGlossaryTerm",
  305. limit: 10,
  306. offset: 0
  307. };
  308. },
  309. processResults: function(data, params) {
  310. return {
  311. results: getTypeAheadData(data, params)
  312. };
  313. },
  314. cache: !0
  315. },
  316. templateResult: function(option) {
  317. var name = Utils.getName(option, "qualifiedName");
  318. return "-" === name ? option.text : name;
  319. },
  320. templateSelection: function(option) {
  321. var name = Utils.getName(option, "qualifiedName");
  322. return "-" === name ? option.text : name;
  323. },
  324. escapeMarkup: function(markup) {
  325. return markup;
  326. },
  327. minimumInputLength: 1
  328. });
  329. },
  330. renderSaveSearch: function() {
  331. var that = this;
  332. require([ "views/search/save/SaveSearchView" ], function(SaveSearchView) {
  333. function fetchSaveSearchCollection() {
  334. saveSearchCollection.fetch({
  335. success: function(collection, data) {
  336. saveSearchAdvanceCollection.fullCollection.reset(_.where(data, {
  337. searchType: "ADVANCED"
  338. })), saveSearchBaiscCollection.fullCollection.reset(_.where(data, {
  339. searchType: "BASIC"
  340. }));
  341. },
  342. silent: !0
  343. });
  344. }
  345. function getModelName(model) {
  346. if (model.get("name")) return model.get("name").toLowerCase();
  347. }
  348. var saveSearchBaiscCollection = new VSearchList(), saveSearchAdvanceCollection = new VSearchList(), saveSearchCollection = new VSearchList();
  349. saveSearchCollection.url = UrlLinks.saveSearchApiUrl(), saveSearchBaiscCollection.fullCollection.comparator = function(model) {
  350. return getModelName(model);
  351. }, saveSearchAdvanceCollection.fullCollection.comparator = function(model) {
  352. return getModelName(model);
  353. };
  354. var obj = {
  355. value: that.value,
  356. searchVent: that.searchVent,
  357. typeHeaders: that.typeHeaders,
  358. fetchCollection: fetchSaveSearchCollection,
  359. classificationDefCollection: that.classificationDefCollection,
  360. entityDefCollection: that.entityDefCollection,
  361. getValue: function() {
  362. var queryObj = that.query[that.type], entityObj = that.searchTableFilters.entityFilters, tagObj = that.searchTableFilters.tagFilters, urlObj = Utils.getUrlState.getQueryParams();
  363. return urlObj && (urlObj.includeDE = "true" == urlObj.includeDE, urlObj.excludeSC = "true" == urlObj.excludeSC,
  364. urlObj.excludeST = "true" == urlObj.excludeST), _.extend({}, queryObj, urlObj, {
  365. entityFilters: entityObj ? entityObj[queryObj.type] : null,
  366. tagFilters: tagObj ? tagObj[queryObj.tag] : null,
  367. type: queryObj.type,
  368. query: queryObj.query,
  369. term: queryObj.term,
  370. tag: queryObj.tag
  371. });
  372. },
  373. applyValue: function(model, searchType) {
  374. that.manualRender(_.extend(searchType, CommonViewFunction.generateUrlFromSaveSearchObject({
  375. value: {
  376. searchParameters: model.get("searchParameters"),
  377. uiParameters: model.get("uiParameters")
  378. },
  379. classificationDefCollection: that.classificationDefCollection,
  380. entityDefCollection: that.entityDefCollection
  381. })));
  382. }
  383. };
  384. that.RSaveSearchBasic.show(new SaveSearchView(_.extend(obj, {
  385. isBasic: !0,
  386. collection: saveSearchBaiscCollection.fullCollection
  387. }))), that.RSaveSearchAdvance.show(new SaveSearchView(_.extend(obj, {
  388. isBasic: !1,
  389. collection: saveSearchAdvanceCollection.fullCollection
  390. }))), fetchSaveSearchCollection();
  391. });
  392. },
  393. findSearchResult: function() {
  394. this.triggerSearch(this.ui.searchInput.val());
  395. },
  396. triggerSearch: function(value) {
  397. var params = {
  398. searchType: this.type,
  399. dslChecked: this.ui.searchType.is(":checked"),
  400. tagFilters: null,
  401. entityFilters: null
  402. }, typeLovValue = this.ui.typeLov.find(":selected").data("name"), tagLovValue = this.ui.tagLov.find(":selected").data("name"), termLovValue = this.ui.termLov.select2("val");
  403. if (params.type = typeLovValue || null, !this.dsl) {
  404. params.tag = tagLovValue || null, params.term = termLovValue || null;
  405. var entityFilterObj = this.searchTableFilters.entityFilters, tagFilterObj = this.searchTableFilters.tagFilters;
  406. this.value.tag && (params.tagFilters = tagFilterObj[this.value.tag]), this.value.type && (params.entityFilters = entityFilterObj[this.value.type]);
  407. var columnList = this.value && this.value.type && this.searchTableColumns ? this.searchTableColumns[this.value.type] : null;
  408. columnList && (params.attributes = columnList.join(",")), params.includeDE = !_.isUndefinedNull(this.value.includeDE) && this.value.includeDE,
  409. params.excludeST = !_.isUndefinedNull(this.value.excludeST) && this.value.excludeST,
  410. params.excludeSC = !_.isUndefinedNull(this.value.excludeSC) && this.value.excludeSC;
  411. }
  412. _.isUndefinedNull(this.value.pageLimit) || (params.pageLimit = this.value.pageLimit),
  413. _.isUndefinedNull(this.value.pageOffset) || (_.isUndefinedNull(this.query[this.type]) || this.query[this.type].query == value ? params.pageOffset = this.value.pageOffset : params.pageOffset = 0),
  414. params.query = value || null, _.extend(this.query[this.type], params), this.onSubmit && this.onSubmit(this.query[this.type]),
  415. Utils.setUrl({
  416. url: "#!/search/searchResult",
  417. urlParams: _.extend({}, this.query[this.type]),
  418. mergeBrowserUrl: !1,
  419. trigger: !0,
  420. updateTabState: !0
  421. });
  422. },
  423. dslFulltextToggle: function(e, triggerUrl) {
  424. var paramObj = Utils.getUrlState.getQueryParams();
  425. paramObj && this.type == paramObj.searchType && this.updateQueryObject(paramObj),
  426. e ? (this.type = "dsl", this.dsl = !0, this.$(".typeFilterBtn,.tagBox,.termBox,.basicSaveSearch").hide(),
  427. this.$(".advanceSaveSearch,.searchByText").show(), this.$(".searchText").text("Search By Query"),
  428. this.ui.searchInput.attr("placeholder", 'Search By Query eg. where name="sales_fact"')) : (this.$(".typeFilterBtn,.tagBox,.termBox,.basicSaveSearch").show(),
  429. this.$(".advanceSaveSearch,.searchByText").hide(), this.dsl = !1, this.type = "basic",
  430. this.ui.searchInput.attr("placeholder", "Search By Text")), triggerUrl !== !1 && Utils.getUrlState.isSearchTab() && Utils.setUrl({
  431. url: "#!/search/searchResult",
  432. urlParams: _.extend(this.query[this.type], {
  433. searchType: this.type,
  434. dslChecked: this.ui.searchType.is(":checked")
  435. }),
  436. mergeBrowserUrl: !1,
  437. trigger: !0,
  438. updateTabState: !0
  439. });
  440. },
  441. clearSearchData: function() {
  442. this.filterTypeSelected = [], this.renderTypeTagList(), this.updateQueryObject(),
  443. this.ui.typeLov.val("").trigger("change"), this.ui.tagLov.val("").trigger("change"),
  444. this.ui.searchInput.val("");
  445. var type = "basicSaveSearch";
  446. "dsl" == this.type && (type = "advanceSaveSearch"), this.$("." + type + " .saveSearchList").find("li.active").removeClass("active"),
  447. this.$("." + type + ' [data-id="saveBtn"]').attr("disabled", !0), this.dsl || (this.searchTableFilters.tagFilters = {},
  448. this.searchTableFilters.entityFilters = {}), this.checkForButtonVisiblity();
  449. }
  450. });
  451. return SearchLayoutView;
  452. });