SearchResultLayoutView.js 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854
  1. define([ "require", "backbone", "table-dragger", "hbs!tmpl/search/SearchResultLayoutView_tmpl", "modules/Modal", "models/VEntity", "utils/Utils", "utils/Globals", "collection/VSearchList", "models/VCommon", "utils/CommonViewFunction", "utils/Messages", "utils/Enums", "utils/UrlLinks", "moment", "platform" ], function(require, Backbone, tableDragger, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages, Enums, UrlLinks, moment, platform) {
  2. "use strict";
  3. var SearchResultLayoutView = Backbone.Marionette.LayoutView.extend({
  4. _viewName: "SearchResultLayoutView",
  5. template: SearchResultLayoutViewTmpl,
  6. regions: {
  7. REntityTableLayoutView: "#r_searchResultTableLayoutView",
  8. RSearchQuery: "#r_searchQuery"
  9. },
  10. ui: {
  11. tagClick: '[data-id="tagClick"]',
  12. termClick: '[data-id="termClick"]',
  13. addTag: '[data-id="addTag"]',
  14. addTerm: '[data-id="addTerm"]',
  15. paginationDiv: '[data-id="paginationDiv"]',
  16. previousData: "[data-id='previousData']",
  17. nextData: "[data-id='nextData']",
  18. pageRecordText: "[data-id='pageRecordText']",
  19. addAssignTag: "[data-id='addAssignTag']",
  20. addAssignTerm: "[data-id='addAssignTerm']",
  21. createEntity: "[data-id='createEntity']",
  22. checkDeletedEntity: "[data-id='checkDeletedEntity']",
  23. checkSubClassification: "[data-id='checkSubClassification']",
  24. checkSubType: "[data-id='checkSubType']",
  25. colManager: "[data-id='colManager']",
  26. containerCheckBox: "[data-id='containerCheckBox']",
  27. columnEmptyInfo: "[data-id='columnEmptyInfo']",
  28. showPage: "[data-id='showPage']",
  29. gotoPage: "[data-id='gotoPage']",
  30. gotoPagebtn: "[data-id='gotoPagebtn']",
  31. activePage: "[data-id='activePage']",
  32. saveFilter: "[data-id='saveFilter']"
  33. },
  34. templateHelpers: function() {
  35. return {
  36. entityCreate: Globals.entityCreate,
  37. searchType: this.searchType,
  38. fromView: this.fromView,
  39. isGlossaryView: "glossary" == this.fromView,
  40. isSearchTab: Utils.getUrlState.isSearchTab()
  41. };
  42. },
  43. events: function() {
  44. var events = {}, that = this;
  45. return events["click " + this.ui.tagClick] = function(e) {
  46. var scope = $(e.currentTarget);
  47. "i" == e.target.nodeName.toLocaleLowerCase() ? this.onClickTagCross(e) : (this.triggerUrl({
  48. url: "#!/tag/tagAttribute/" + scope.text(),
  49. urlParams: null,
  50. mergeBrowserUrl: !1,
  51. trigger: !0,
  52. updateTabState: !0
  53. }), console.log(Globals));
  54. }, events["click " + this.ui.termClick] = function(e) {
  55. var scope = $(e.currentTarget);
  56. "i" == e.target.nodeName.toLocaleLowerCase() ? this.onClickTermCross(e) : this.triggerUrl({
  57. url: "#!/glossary/" + scope.find("i").data("termguid"),
  58. urlParams: {
  59. gType: "term",
  60. viewType: "term",
  61. fromView: "entity"
  62. },
  63. mergeBrowserUrl: !1,
  64. trigger: !0,
  65. updateTabState: null
  66. });
  67. }, events["keyup " + this.ui.gotoPage] = function(e) {
  68. var code = e.which;
  69. parseInt(e.currentTarget.value);
  70. e.currentTarget.value ? that.ui.gotoPagebtn.attr("disabled", !1) : that.ui.gotoPagebtn.attr("disabled", !0),
  71. 13 == code && e.currentTarget.value && that.gotoPagebtn();
  72. }, events["change " + this.ui.showPage] = "changePageLimit", events["click " + this.ui.gotoPagebtn] = "gotoPagebtn",
  73. events["click " + this.ui.addTag] = "onClickAddTag", events["click " + this.ui.addTerm] = "onClickAddTermBtn",
  74. events["click " + this.ui.addAssignTag] = "onClickAddTag", events["click " + this.ui.addAssignTerm] = "onClickAddTermBtn",
  75. events["click " + this.ui.nextData] = "onClicknextData", events["click " + this.ui.previousData] = "onClickpreviousData",
  76. events["click " + this.ui.createEntity] = "onClickCreateEntity", events["click " + this.ui.checkDeletedEntity] = "onCheckExcludeIncludeResult",
  77. events["click " + this.ui.checkSubClassification] = "onCheckExcludeIncludeResult",
  78. events["click " + this.ui.checkSubType] = "onCheckExcludeIncludeResult", events["click " + this.ui.saveFilter] = function() {
  79. this.searchVent && this.searchVent.trigger("Save:Filter");
  80. }, events;
  81. },
  82. initialize: function(options) {
  83. if (_.extend(this, _.pick(options, "value", "guid", "initialView", "isTypeTagNotExists", "classificationDefCollection", "entityDefCollection", "typeHeaders", "searchVent", "categoryEvent", "enumDefCollection", "tagCollection", "searchTableColumns", "isTableDropDisable", "fromView", "glossaryCollection", "termName", "businessMetadataDefCollection", "profileDBView")),
  84. this.entityModel = new VEntity(), this.searchCollection = new VSearchList(), this.limit = 25,
  85. this.asyncFetchCounter = 0, this.offset = 0, this.bindEvents(), this.multiSelectEntity = [],
  86. this.searchType = "基础查询", this.columnOrder = null, this.defaultColumns = [ "selected", "name", "description", "typeName", "owner", "tag", "term" ],
  87. this.value) {
  88. if (this.value.searchType && "dsl" == this.value.searchType && (this.searchType = "高级查询"),
  89. this.value.pageLimit) {
  90. var pageLimit = parseInt(this.value.pageLimit, 10);
  91. _.isNaN(pageLimit) || 0 == pageLimit || pageLimit <= -1 ? (this.value.pageLimit = this.limit,
  92. this.triggerUrl()) : this.limit = pageLimit;
  93. }
  94. if (this.value.pageOffset) {
  95. var pageOffset = parseInt(this.value.pageOffset, 10);
  96. _.isNaN(pageOffset) || pageLimit <= -1 ? (this.value.pageOffset = this.offset, this.triggerUrl()) : this.offset = pageOffset;
  97. }
  98. }
  99. "IE" === platform.name && (this.isTableDropDisable = !0);
  100. },
  101. bindEvents: function() {
  102. var that = this;
  103. this.onClickLoadMore(), this.listenTo(this.searchCollection, "backgrid:selected", function(model, checked) {
  104. this.multiSelectEntity = [], checked === !0 ? model.set("isEnable", !0) : model.set("isEnable", !1),
  105. this.searchCollection.find(function(item) {
  106. if (item.get("isEnable")) {
  107. var obj = item.toJSON();
  108. that.multiSelectEntity.push({
  109. id: obj.guid,
  110. model: obj
  111. });
  112. }
  113. }), this.updateMultiSelect();
  114. }), this.listenTo(this.searchCollection, "error", function(model, response) {
  115. this.hideLoader({
  116. type: "error"
  117. });
  118. var responseJSON = response && response.responseJSON ? response.responseJSON : null, errorText = responseJSON && (responseJSON.errorMessage || responseJSON.message || responseJSON.error) || "无效表达式";
  119. errorText && (Utils.notifyError({
  120. content: errorText
  121. }), this.$(".searchTable > .well").html("<center>" + errorText + "</center>"));
  122. }, this), this.listenTo(this.searchCollection, "state-changed", function(state) {
  123. if (Utils.getUrlState.isSearchTab()) {
  124. this.updateColumnList(state);
  125. var excludeDefaultColumn = [];
  126. this.value && this.value.type && (excludeDefaultColumn = _.difference(this.searchTableColumns[this.value.type], this.defaultColumns),
  127. null === this.searchTableColumns[this.value.type] ? this.ui.columnEmptyInfo.show() : this.ui.columnEmptyInfo.hide()),
  128. this.columnOrder = this.getColumnOrder(this.REntityTableLayoutView.$el.find(".colSort th.renderable")),
  129. this.triggerUrl();
  130. var attributes = this.searchCollection.filterObj.attributes;
  131. excludeDefaultColumn && attributes && (excludeDefaultColumn.length > attributes.length || _.difference(excludeDefaultColumn, attributes).length) && this.fetchCollection(this.value);
  132. }
  133. }, this), this.listenTo(this.searchVent, "search:refresh", function(model, response) {
  134. this.fetchCollection();
  135. }, this), this.listenTo(this.searchCollection, "backgrid:sorted", function(model, response) {
  136. this.checkTableFetch();
  137. }, this), this.listenTo(this.categoryEvent, "Sucess:TermSearchResultPage", function() {
  138. this.glossaryCollection.fetch({
  139. reset: !0
  140. });
  141. });
  142. },
  143. onRender: function() {
  144. if (Utils.getUrlState.isSearchTab() && this.$(".action-box").hide(), this.checkEntityImage = {},
  145. this.commonTableOptions = {
  146. collection: this.searchCollection,
  147. includePagination: !1,
  148. includeFooterRecords: !1,
  149. includeColumnManager: !(!Utils.getUrlState.isSearchTab() || !this.value || "basic" !== this.value.searchType || this.profileDBView),
  150. includeOrderAbleColumns: !1,
  151. includeSizeAbleColumns: !1,
  152. includeTableLoader: !1,
  153. includeAtlasTableSorting: !0,
  154. showDefaultTableSorted: !0,
  155. updateFullCollectionManually: !0,
  156. columnOpts: {
  157. opts: {
  158. initialColumnsVisible: null,
  159. saveState: !1
  160. },
  161. visibilityControlOpts: {
  162. buttonTemplate: _.template("<button class='btn btn-action btn-sm pull-right'>Columns&nbsp<i class='fa fa-caret-down'></i></button>")
  163. },
  164. el: this.ui.colManager
  165. },
  166. gridOpts: {
  167. emptyText: "No Records found!",
  168. className: "table table-hover backgrid table-quickMenu colSort"
  169. },
  170. sortOpts: {
  171. sortColumn: "name",
  172. sortDirection: "ascending"
  173. },
  174. filterOpts: {},
  175. paginatorOpts: {}
  176. }, this.initialView) Globals.entityTypeConfList && this.$(".entityLink").show(),
  177. this.isTypeTagNotExists && Utils.notifyError({
  178. content: Messages.search.notExists
  179. }); else {
  180. var value = {};
  181. this.value ? (value = this.value, value && value.includeDE && this.ui.checkDeletedEntity.prop("checked", !0),
  182. value && value.excludeSC && this.ui.checkSubClassification.prop("checked", !0),
  183. value && value.excludeST && this.ui.checkSubType.prop("checked", !0)) : value = {
  184. query: null,
  185. searchType: "basic"
  186. }, this.updateColumnList(), this.value && this.searchTableColumns && null === this.searchTableColumns[this.value.type] ? this.ui.columnEmptyInfo.show() : this.ui.columnEmptyInfo.hide(),
  187. this.fetchCollection(value, _.extend({
  188. fromUrl: !0
  189. }, this.value && this.value.pageOffset ? {
  190. next: !0
  191. } : null)), this.ui.showPage.select2({
  192. data: _.sortBy(_.union([ 25, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500 ], [ this.limit ])),
  193. tags: !0,
  194. dropdownCssClass: "number-input",
  195. multiple: !1
  196. }), this.value && this.value.pageLimit && this.ui.showPage.val(this.limit).trigger("change", {
  197. skipViewChange: !0
  198. });
  199. }
  200. },
  201. getColumnOrderWithPosition: function() {
  202. var that = this;
  203. return _.map(that.columnOrder, function(value, key) {
  204. return key + "::" + value;
  205. }).join(",");
  206. },
  207. triggerUrl: function(options) {
  208. Utils.setUrl(_.extend({
  209. url: Utils.getUrlState.getQueryUrl().queyParams[0],
  210. urlParams: this.columnOrder ? _.extend(this.value, {
  211. uiParameters: this.getColumnOrderWithPosition()
  212. }) : this.value,
  213. mergeBrowserUrl: !1,
  214. trigger: !1,
  215. updateTabState: !0
  216. }, options));
  217. },
  218. updateMultiSelect: function() {
  219. this.multiSelectEntity.length > 0 ? this.$(".multiSelectTag,.multiSelectTerm").show() : this.$(".multiSelectTag,.multiSelectTerm").hide();
  220. },
  221. updateColumnList: function(updatedList) {
  222. if (updatedList) {
  223. var listOfColumns = [];
  224. _.map(updatedList, function(obj) {
  225. obj.name;
  226. obj.renderable && listOfColumns.push(obj.name);
  227. }), listOfColumns = _.sortBy(listOfColumns), this.value.attributes = listOfColumns.length ? listOfColumns.join(",") : null,
  228. this.value && this.value.type && this.searchTableColumns && (this.searchTableColumns[this.value.type] = listOfColumns.length ? listOfColumns : null);
  229. } else this.value && this.value.type && this.searchTableColumns && this.value.attributes && (this.searchTableColumns[this.value.type] = this.value.attributes.split(","));
  230. },
  231. fetchCollection: function(value, options) {
  232. var that = this, isPostMethod = this.value && "basic" === this.value.searchType, isSearchTab = Utils.getUrlState.isSearchTab(), tagFilters = null, entityFilters = null;
  233. if (isSearchTab && (tagFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.tagFilters),
  234. entityFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.entityFilters)),
  235. isPostMethod && isSearchTab) var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.difference(this.searchTableColumns[this.value.type], this.defaultColumns) : null, filterObj = {
  236. entityFilters: entityFilters,
  237. tagFilters: tagFilters,
  238. attributes: excludeDefaultColumn ? excludeDefaultColumn : null
  239. };
  240. this.showLoader(), Globals.searchApiCallRef && 1 === Globals.searchApiCallRef.readyState && Globals.searchApiCallRef.abort();
  241. var apiObj = {
  242. skipDefaultError: !0,
  243. sort: !1,
  244. success: function(dataOrCollection, response) {
  245. if (!that.isDestroyed) {
  246. Globals.searchApiCallRef = void 0;
  247. var isFirstPage = 0 === that.offset, dataLength = 0, goToPage = that.ui.gotoPage.val();
  248. if (that.ui.gotoPage.val(""), that.ui.gotoPage.parent().removeClass("has-error"),
  249. that.ui.gotoPagebtn.prop("disabled", !0), that.ui.pageRecordText instanceof jQuery) {
  250. if (dataLength = isPostMethod && dataOrCollection && dataOrCollection.entities ? dataOrCollection.entities.length : dataOrCollection.length,
  251. !dataLength && that.offset >= that.limit && (options && options.next || goToPage) && options && !options.fromUrl) {
  252. that.hideLoader();
  253. var pageNumber = that.activePage + 1;
  254. return goToPage ? (pageNumber = goToPage, that.offset = (that.activePage - 1) * that.limit) : (that.finalPage = that.activePage,
  255. that.ui.nextData.attr("disabled", !0), that.offset = that.offset - that.limit),
  256. that.value && (that.value.pageOffset = that.offset, that.triggerUrl()), void Utils.notifyInfo({
  257. html: !0,
  258. content: Messages.search.noRecordForPage + "<b>" + Utils.getNumberSuffix({
  259. number: pageNumber,
  260. sup: !0
  261. }) + "</b> 页"
  262. });
  263. }
  264. if (isPostMethod && (Utils.findAndMergeRefEntity({
  265. attributeObject: dataOrCollection.entities,
  266. referredEntities: dataOrCollection.referredEntities
  267. }), that.searchCollection.reset(dataOrCollection.entities, {
  268. silent: !0
  269. }), that.searchCollection.fullCollection.reset(dataOrCollection.entities, {
  270. silent: !0
  271. })), dataLength < that.limit ? that.ui.nextData.attr("disabled", !0) : that.ui.nextData.attr("disabled", !1),
  272. isFirstPage && (!dataLength || dataLength < that.limit) ? that.ui.paginationDiv.hide() : that.ui.paginationDiv.show(),
  273. isFirstPage ? (that.ui.previousData.attr("disabled", !0), that.pageFrom = 1, that.pageTo = that.limit) : that.ui.previousData.attr("disabled", !1),
  274. options && options.next ? (that.pageTo = that.offset + that.limit, that.pageFrom = that.offset + 1) : !isFirstPage && options && options.previous && (that.pageTo = that.pageTo - that.limit,
  275. that.pageFrom = that.pageTo - that.limit + 1), that.ui.pageRecordText.html("Showing <u>" + that.searchCollection.models.length + " records</u> From " + that.pageFrom + " - " + that.pageTo),
  276. that.activePage = Math.round(that.pageTo / that.limit), that.ui.activePage.attr("title", "Page " + that.activePage),
  277. that.ui.activePage.text(that.activePage), that.renderTableLayoutView(), that.multiSelectEntity = [],
  278. that.updateMultiSelect(), dataLength > 0 && that.$(".searchTable").removeClass("noData"),
  279. Utils.getUrlState.isSearchTab() && value && !that.profileDBView) {
  280. var isCapsuleView = !0, searchString = '<span class="filterQuery">' + CommonViewFunction.generateQueryOfFilter(that.value, isCapsuleView) + "</span>";
  281. Globals.entityCreate && Globals.entityTypeConfList && Utils.getUrlState.isSearchTab(),
  282. that.$(".searchResult").html(searchString);
  283. }
  284. }
  285. }
  286. },
  287. silent: !0,
  288. reset: !0
  289. };
  290. if (this.value) var checkBoxValue = {
  291. excludeDeletedEntities: !this.value.includeDE,
  292. includeSubClassifications: !this.value.excludeSC,
  293. includeSubTypes: !this.value.excludeST,
  294. includeClassificationAttributes: !0
  295. };
  296. if (value) {
  297. if (value.searchType && (this.searchCollection.url = UrlLinks.searchApiUrl(value.searchType)),
  298. _.extend(this.searchCollection.queryParams, {
  299. limit: this.limit,
  300. offset: this.offset,
  301. query: _.trim(value.query),
  302. typeName: value.type || null,
  303. classification: value.tag || null,
  304. termName: value.term || null
  305. }), this.profileDBView && value.typeName && value.guid) {
  306. var profileParam = {};
  307. profileParam.guid = value.guid, profileParam.relation = "hive_db" === value.typeName ? "__hive_table.db" : "__hbase_table.namespace",
  308. profileParam.sortBy = "name", profileParam.sortOrder = "ASCENDING", _.extend(this.searchCollection.queryParams, profileParam);
  309. }
  310. isPostMethod ? (this.searchCollection.filterObj = _.extend({}, filterObj), apiObj.data = _.extend(checkBoxValue, filterObj, _.pick(this.searchCollection.queryParams, "query", "excludeDeletedEntities", "limit", "offset", "typeName", "classification", "termName")),
  311. Globals.searchApiCallRef = this.searchCollection.getBasicRearchResult(apiObj)) : (apiObj.data = null,
  312. this.searchCollection.filterObj = null, this.profileDBView && _.extend(this.searchCollection.queryParams, checkBoxValue),
  313. Globals.searchApiCallRef = this.searchCollection.fetch(apiObj));
  314. } else _.extend(this.searchCollection.queryParams, {
  315. limit: this.limit,
  316. offset: this.offset
  317. }), isPostMethod ? (apiObj.data = _.extend(checkBoxValue, filterObj, _.pick(this.searchCollection.queryParams, "query", "excludeDeletedEntities", "limit", "offset", "typeName", "classification", "termName")),
  318. Globals.searchApiCallRef = this.searchCollection.getBasicRearchResult(apiObj)) : (apiObj.data = null,
  319. this.profileDBView && _.extend(this.searchCollection.queryParams, checkBoxValue),
  320. Globals.searchApiCallRef = this.searchCollection.fetch(apiObj));
  321. },
  322. tableRender: function(options) {
  323. var that = this, savedColumnOrder = options.order, TableLayout = options.table, columnCollection = Backgrid.Columns.extend({
  324. sortKey: "displayOrder",
  325. className: "my-awesome-css-animated-grid",
  326. comparator: function(item) {
  327. return item.get(this.sortKey) || 999;
  328. },
  329. setPositions: function() {
  330. return _.each(this.models, function(model, index) {
  331. model.set("displayOrder", (null == savedColumnOrder ? index : parseInt(savedColumnOrder[model.get("label")])) + 1, {
  332. silent: !0
  333. });
  334. }), this;
  335. }
  336. }), columns = new columnCollection(that.searchCollection.dynamicTable ? that.getDaynamicColumns(that.searchCollection.toJSON()) : that.getFixedDslColumn());
  337. if (columns.setPositions().sort(), "Advanced Search" == this.searchType && columns.length && that.searchCollection.length) {
  338. var tableColumnNames = Object.keys(that.searchCollection.toJSON()[0]);
  339. that.commonTableOptions.sortOpts = {
  340. sortColumn: tableColumnNames[0],
  341. sortDirection: "ascending"
  342. };
  343. }
  344. var table = new TableLayout(_.extend({}, that.commonTableOptions, {
  345. columns: columns
  346. }));
  347. if (0 === table.collection.length && that.$(".searchTable").addClass("noData"),
  348. that.REntityTableLayoutView && (that.value || (that.value = that.options.value),
  349. that.REntityTableLayoutView.show(table), "dsl" !== that.value.searchType ? that.ui.containerCheckBox.show() : that.ui.containerCheckBox.hide(),
  350. that.$(".ellipsis-with-margin .inputAssignTag").hide(), table.trigger("grid:refresh"),
  351. that.isTableDropDisable !== !0)) {
  352. var tableDropFunction = function(from, to, el) {
  353. tableDragger(document.querySelector(".colSort")).destroy(), that.columnOrder = that.getColumnOrder(el.querySelectorAll("th.renderable")),
  354. that.triggerUrl(), that.tableRender({
  355. order: that.columnOrder,
  356. table: TableLayout
  357. }), that.checkTableFetch();
  358. };
  359. that.REntityTableLayoutView.$el.find(".colSort thead tr th:not(.select-all-header-cell)").addClass("dragHandler"),
  360. tableDragger(document.querySelector(".colSort"), {
  361. dragHandler: ".dragHandler"
  362. }).on("drop", tableDropFunction);
  363. }
  364. },
  365. renderTableLayoutView: function(col) {
  366. var that = this;
  367. require([ "utils/TableLayout" ], function(TableLayout) {
  368. if (that.value.uiParameters) var savedColumnOrder = _.object(that.value.uiParameters.split(",").map(function(a) {
  369. return a.split("::");
  370. }));
  371. that.tableRender({
  372. order: savedColumnOrder,
  373. table: TableLayout
  374. }), that.checkTableFetch();
  375. });
  376. },
  377. getColumnOrder: function(arr) {
  378. for (var obj = {}, i = 0; i < arr.length; ++i) {
  379. var innerText = arr[i].innerText.trim();
  380. obj["" == innerText ? "Select" : innerText] = i;
  381. }
  382. return obj;
  383. },
  384. checkTableFetch: function() {
  385. this.asyncFetchCounter <= 0 && (this.hideLoader(), Utils.generatePopover({
  386. el: this.$('[data-id="showMoreLess"]'),
  387. contentClass: "popover-tag-term",
  388. viewFixedPopover: !0,
  389. popoverOptions: {
  390. container: null,
  391. content: function() {
  392. return $(this).find(".popup-tag-term").children().clone();
  393. }
  394. }
  395. }));
  396. },
  397. getFixedDslColumn: function() {
  398. var that = this, columnToShow = null, col = {};
  399. if (this.value = Utils.getUrlState.getQueryParams() || this.value, this.value && "basic" === this.value.searchType && this.searchTableColumns && void 0 !== this.searchTableColumns[this.value.type] && (columnToShow = null == this.searchTableColumns[this.value.type] ? [] : this.searchTableColumns[this.value.type]),
  400. col.Check = {
  401. name: "selected",
  402. label: "Select",
  403. cell: "select-row",
  404. resizeable: !1,
  405. orderable: !1,
  406. alwaysVisible: !0,
  407. renderable: !columnToShow || _.contains(columnToShow, "selected"),
  408. headerCell: "select-all"
  409. }, col.name = {
  410. label: this.value && this.profileDBView ? "Table Name" : "Name",
  411. cell: "html",
  412. editable: !1,
  413. resizeable: !0,
  414. orderable: !1,
  415. renderable: !0,
  416. className: "searchTableName",
  417. formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
  418. fromRaw: function(rawValue, model) {
  419. var obj = model.toJSON(), nameHtml = "", name = Utils.getName(obj);
  420. if (obj.attributes && void 0 !== obj.attributes.serviceType) void 0 === Globals.serviceTypeMap[obj.typeName] && (Globals.serviceTypeMap[obj.typeName] = obj.attributes ? obj.attributes.serviceType : null); else if (void 0 === Globals.serviceTypeMap[obj.typeName] && that.entityDefCollection) {
  421. var defObj = that.entityDefCollection.fullCollection.find({
  422. name: obj.typeName
  423. });
  424. defObj && (Globals.serviceTypeMap[obj.typeName] = defObj.get("serviceType"));
  425. }
  426. obj.serviceType = Globals.serviceTypeMap[obj.typeName], nameHtml = obj.guid ? "-1" == obj.guid ? '<span title="' + name + '">' + name + "</span>" : '<a title="' + name + '" href="#!/detailPage/' + obj.guid + (that.fromView ? "?from=" + that.fromView : "") + '">' + name + "</a>" : '<span title="' + name + '">' + name + "</span>",
  427. obj.status && Enums.entityStateReadOnly[obj.status] && (nameHtml += '<button type="button" title="Deleted" class="btn btn-action btn-md deleteBtn"><i class="fa fa-trash"></i></button>',
  428. nameHtml = '<div class="readOnly readOnlyLink">' + nameHtml + "</div>");
  429. var getImageData = function(options) {
  430. var imagePath = options.imagePath, returnImgUrl = null;
  431. that.checkEntityImage[model.get("guid")] = !1, $.ajax({
  432. url: imagePath,
  433. method: "get",
  434. cache: !0
  435. }).always(function(data, status, xhr) {
  436. 404 == data.status ? returnImgUrl = getImageData({
  437. imagePath: Utils.getEntityIconPath({
  438. entityData: obj,
  439. errorUrl: imagePath
  440. })
  441. }) : data && (that.checkEntityImage[model.get("guid")] = imagePath, returnImgUrl = imagePath,
  442. that.$("img[data-imgGuid='" + obj.guid + "']").removeClass("searchTableLogoLoader").attr("src", imagePath));
  443. });
  444. }, img = "";
  445. return img = "<div><img data-imgGuid='" + obj.guid + "' class='searchTableLogoLoader'></div>",
  446. void 0 == that.checkEntityImage[model.get("guid")] ? getImageData({
  447. imagePath: Utils.getEntityIconPath({
  448. entityData: obj
  449. })
  450. }) : 0 != that.checkEntityImage[model.get("guid")] && (img = "<div><img data-imgGuid='" + obj.guid + "' src='" + that.checkEntityImage[model.get("guid")] + "'></div>"),
  451. img + nameHtml;
  452. }
  453. })
  454. }, col.owner = {
  455. label: "Owner",
  456. cell: "String",
  457. editable: !1,
  458. resizeable: !0,
  459. orderable: !0,
  460. renderable: !0,
  461. formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
  462. fromRaw: function(rawValue, model) {
  463. var obj = model.toJSON();
  464. if (obj && obj.attributes && obj.attributes.owner) return obj.attributes.owner;
  465. }
  466. })
  467. }, this.value && this.profileDBView && (col.createTime = {
  468. label: "Date Created",
  469. cell: "Html",
  470. editable: !1,
  471. formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
  472. fromRaw: function(rawValue, model) {
  473. var obj = model.toJSON();
  474. return obj && obj.attributes && obj.attributes.createTime ? Utils.formatDate({
  475. date: obj.attributes.createTime
  476. }) : "-";
  477. }
  478. })
  479. }), this.value && !this.profileDBView && (col.description = {
  480. label: "Description",
  481. cell: "String",
  482. editable: !1,
  483. resizeable: !0,
  484. orderable: !0,
  485. renderable: !0,
  486. formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
  487. fromRaw: function(rawValue, model) {
  488. var obj = model.toJSON();
  489. if (obj && obj.attributes && obj.attributes.description) return obj.attributes.description;
  490. }
  491. })
  492. }, col.typeName = {
  493. label: "Type",
  494. cell: "Html",
  495. editable: !1,
  496. resizeable: !0,
  497. orderable: !0,
  498. renderable: !columnToShow || _.contains(columnToShow, "typeName"),
  499. formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
  500. fromRaw: function(rawValue, model) {
  501. var obj = model.toJSON();
  502. if (obj && obj.typeName) return '<a title="Search ' + obj.typeName + '" href="#!/search/searchResult?type=' + obj.typeName + '&searchType=basic">' + obj.typeName + "</a>";
  503. }
  504. })
  505. }, this.getTagCol({
  506. col: col,
  507. columnToShow: columnToShow
  508. }), _.contains([ "glossary" ], this.fromView) || this.getTermCol({
  509. col: col,
  510. columnToShow: columnToShow
  511. }), this.value && "basic" === this.value.searchType)) {
  512. var def = this.entityDefCollection.fullCollection.find({
  513. name: this.value.type
  514. }), systemAttr = [], businessMetadataAttr = [], businessAttributes = {};
  515. if ("_ALL_ENTITY_TYPES" == this.value.type ? this.businessMetadataDefCollection.each(function(model) {
  516. var sortedAttributes = model.get("attributeDefs") || null, name = model.get("name");
  517. sortedAttributes && (sortedAttributes = _.sortBy(sortedAttributes, function(obj) {
  518. return obj.name;
  519. }), businessAttributes[name] = $.extend(!0, {}, sortedAttributes));
  520. }) : businessAttributes = def ? $.extend(!0, {}, def.get("businessAttributeDefs")) || null : null,
  521. def || Globals[this.value.type] || (this.value.tag ? Globals[this.value.tag] ? Globals[this.value.tag] : Globals[Enums.addOnClassification[0]] : void 0)) {
  522. var attrObj = def ? Utils.getNestedSuperTypeObj({
  523. data: def.toJSON(),
  524. collection: this.entityDefCollection,
  525. attrMerge: !0
  526. }) : [];
  527. this.value.type && (Globals[this.value.type] || Globals[Enums.addOnEntities[0]]) && (systemAttr = (Globals[this.value.type] || Globals[Enums.addOnEntities[0]]).attributeDefs),
  528. this.value.tag && (Globals[this.value.tag] || Globals[Enums.addOnClassification[0]]) && (systemAttr = (Globals[this.value.tag] || Globals[Enums.addOnClassification[0]]).attributeDefs),
  529. attrObj = attrObj.concat(systemAttr), businessAttributes && _.each(businessAttributes, function(businessMetadata, businessMetadataName) {
  530. _.each(businessMetadata, function(attr, index) {
  531. var attribute = attr;
  532. attribute.isBusinessAttributes = !0, attribute.name = businessMetadataName + "." + attribute.name,
  533. businessMetadataAttr.push(attribute);
  534. });
  535. }), attrObj = attrObj.concat(businessMetadataAttr), _.each(attrObj, function(obj, key) {
  536. var key = obj.name, isRenderable = _.contains(columnToShow, key), isSortable = obj.typeName.search(/(array|map)/i) == -1;
  537. return "name" == key || "description" == key || "owner" == key ? void (columnToShow && (col[key].renderable = isRenderable)) : void ("__historicalGuids" != key && "__classificationsText" != key && "__classificationNames" != key && "__propagatedClassificationNames" != key && (col[obj.name] = {
  538. label: Enums.systemAttributes[obj.name] ? Enums.systemAttributes[obj.name] : _.escape(obj.isBusinessAttributes ? obj.name : obj.name.capitalize()),
  539. cell: "Html",
  540. headerCell: Backgrid.HeaderHTMLDecodeCell,
  541. editable: !1,
  542. resizeable: !0,
  543. orderable: !0,
  544. sortable: isSortable,
  545. renderable: isRenderable,
  546. headerClassName: obj.isBusinessAttributes ? "no-capitalize" : "",
  547. formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
  548. fromRaw: function(rawValue, model) {
  549. var modelObj = model.toJSON();
  550. if (modelObj && modelObj.attributes && !_.isUndefined(modelObj.attributes[key])) {
  551. var tempObj = {
  552. scope: that,
  553. attributeDefs: [ obj ],
  554. valueObject: {},
  555. isTable: !1
  556. };
  557. if ("__labels" == key) {
  558. var values = modelObj.attributes[key] ? modelObj.attributes[key].split("|") : null, valueOfArray = [];
  559. if (values) return "" === values[values.length - 1] && values.pop(), "" === values[0] && values.shift(),
  560. _.each(values, function(names) {
  561. valueOfArray.push('<span class="json-string"><a class="btn btn-action btn-sm btn-blue btn-icon" ><span>' + _.escape(names) + "</span></a></span>");
  562. }), valueOfArray.join(" ");
  563. }
  564. if ("__customAttributes" == key) {
  565. var customAttributes = modelObj.attributes[key] ? JSON.parse(modelObj.attributes[key]) : null, valueOfArray = [];
  566. if (customAttributes) return _.each(Object.keys(customAttributes), function(value, index) {
  567. valueOfArray.push('<span class="json-string"><a class="btn btn-action btn-sm btn-blue btn-icon" ><span><span>' + _.escape(value) + "</span> : <span>" + _.escape(Object.values(customAttributes)[index]) + "</span></span></a></span>");
  568. }), valueOfArray.join(" ");
  569. }
  570. tempObj.valueObject[key] = modelObj.attributes[key];
  571. var tablecolumn = CommonViewFunction.propertyTable(tempObj);
  572. if (_.isArray(modelObj.attributes[key])) {
  573. var column = $("<div>" + tablecolumn + "</div>");
  574. return tempObj.valueObject[key].length > 2 && column.addClass("toggleList semi-collapsed").append("<span><a data-id='load-more-columns'>Show More</a></span>"),
  575. column;
  576. }
  577. return tablecolumn;
  578. }
  579. }
  580. })
  581. }));
  582. });
  583. }
  584. }
  585. return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
  586. },
  587. onClickLoadMore: function() {
  588. this.$el.on("click", "[data-id='load-more-columns']", function(event) {
  589. event.stopPropagation(), event.stopImmediatePropagation();
  590. var $this = $(this), $toggleList = $(this).parents(".toggleList");
  591. $toggleList.length && ($toggleList.hasClass("semi-collapsed") ? ($toggleList.removeClass("semi-collapsed"),
  592. $this.text("Show Less")) : ($toggleList.addClass("semi-collapsed"), $this.text("Show More")));
  593. });
  594. },
  595. getDaynamicColumns: function(valueObj) {
  596. var that = this, col = {};
  597. if (valueObj && valueObj.length) {
  598. var firstObj = _.first(valueObj);
  599. _.each(_.keys(firstObj), function(key) {
  600. col[key] = {
  601. label: key.capitalize(),
  602. cell: "Html",
  603. editable: !1,
  604. resizeable: !0,
  605. orderable: !0,
  606. formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
  607. fromRaw: function(rawValue, model) {
  608. var modelObj = model.toJSON();
  609. if ("name" == key) {
  610. var nameHtml = "", name = _.escape(modelObj[key]);
  611. return nameHtml = modelObj.guid ? '<a title="' + name + '" href="#!/detailPage/' + modelObj.guid + (that.fromView ? "?from=" + that.fromView : "") + '">' + name + "</a>" : '<span title="' + name + '">' + name + "</span>",
  612. modelObj.status && Enums.entityStateReadOnly[modelObj.status] ? (nameHtml += '<button type="button" title="Deleted" class="btn btn-action btn-md deleteBtn"><i class="fa fa-trash"></i></button>',
  613. '<div class="readOnly readOnlyLink">' + nameHtml + "</div>") : nameHtml;
  614. }
  615. if (modelObj && !_.isUndefined(modelObj[key])) {
  616. var tempObj = {
  617. scope: that,
  618. valueObject: {},
  619. isTable: !1
  620. };
  621. return tempObj.valueObject[key] = modelObj[key], CommonViewFunction.propertyTable(tempObj);
  622. }
  623. }
  624. })
  625. };
  626. });
  627. }
  628. return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
  629. },
  630. getTagCol: function(options) {
  631. var columnToShow = options.columnToShow, col = options.col;
  632. col && (col.tag = {
  633. label: "Classifications",
  634. cell: "Html",
  635. editable: !1,
  636. sortable: !1,
  637. resizeable: !0,
  638. orderable: !0,
  639. renderable: !columnToShow || _.contains(columnToShow, "tag"),
  640. className: "searchTag",
  641. formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
  642. fromRaw: function(rawValue, model) {
  643. var obj = model.toJSON();
  644. if ("-1" != obj.guid) return obj.status && Enums.entityStateReadOnly[obj.status] ? '<div class="readOnly">' + CommonViewFunction.tagForTable(obj) : CommonViewFunction.tagForTable(obj);
  645. }
  646. })
  647. });
  648. },
  649. getTermCol: function(options) {
  650. var columnToShow = options.columnToShow, col = options.col;
  651. col && (col.term = {
  652. label: "Term",
  653. cell: "Html",
  654. editable: !1,
  655. sortable: !1,
  656. resizeable: !0,
  657. orderable: !0,
  658. renderable: !columnToShow || _.contains(columnToShow, "term"),
  659. className: "searchTag",
  660. formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
  661. fromRaw: function(rawValue, model) {
  662. var obj = model.toJSON();
  663. if ("-1" != obj.guid) return obj.typeName && !_.startsWith(obj.typeName, "AtlasGlossary") ? obj.status && Enums.entityStateReadOnly[obj.status] ? '<div class="readOnly">' + CommonViewFunction.termForTable(obj) : CommonViewFunction.termForTable(obj) : void 0;
  664. }
  665. })
  666. });
  667. },
  668. addTagModalView: function(guid, multiple) {
  669. var that = this;
  670. require([ "views/tag/AddTagModalView" ], function(AddTagModalView) {
  671. new AddTagModalView({
  672. guid: guid,
  673. multiple: multiple,
  674. callback: function() {
  675. that.searchVent && that.searchVent.trigger("Classification:Count:Update"), that.multiSelectEntity = [],
  676. that.$(".multiSelectTag,.multiSelectTerm").hide(), that.fetchCollection();
  677. },
  678. tagList: that.getTagList(guid, multiple),
  679. showLoader: that.showLoader.bind(that),
  680. hideLoader: that.hideLoader.bind(that),
  681. collection: that.classificationDefCollection,
  682. enumDefCollection: that.enumDefCollection
  683. });
  684. });
  685. },
  686. getTagList: function(guid, multiple) {
  687. if (multiple && 0 !== multiple.length) return [];
  688. var model = this.searchCollection.find(function(item) {
  689. var obj = item.toJSON();
  690. if (obj.guid === guid) return !0;
  691. });
  692. if (!model) return [];
  693. var obj = model.toJSON();
  694. return _.compact(_.map(obj.classifications, function(val) {
  695. if (val.entityGuid == guid) return val.typeName;
  696. }));
  697. },
  698. showLoader: function() {
  699. this.$(".fontLoader:not(.for-ignore)").addClass("show"), this.$(".tableOverlay").addClass("show");
  700. },
  701. hideLoader: function(options) {
  702. this.$(".fontLoader:not(.for-ignore)").removeClass("show"), this.$(".ellipsis-with-margin").show(),
  703. options && "error" === options.type ? $(".pagination-box").hide() : this.$(".pagination-box").show(),
  704. this.$(".tableOverlay").removeClass("show");
  705. },
  706. onClickAddTag: function(e) {
  707. var guid = "", that = this, isTagMultiSelect = $(e.currentTarget).hasClass("multiSelectTag");
  708. isTagMultiSelect && this.multiSelectEntity && this.multiSelectEntity.length ? that.addTagModalView(guid, this.multiSelectEntity) : (guid = that.$(e.currentTarget).data("guid"),
  709. that.addTagModalView(guid));
  710. },
  711. assignTermModalView: function(glossaryCollection, obj) {
  712. var that = this, terms = 0;
  713. _.each(glossaryCollection.fullCollection.models, function(model) {
  714. model.get("terms") && (terms += model.get("terms").length);
  715. }), terms ? require([ "views/glossary/AssignTermLayoutView" ], function(AssignTermLayoutView) {
  716. new AssignTermLayoutView({
  717. guid: obj.guid,
  718. multiple: obj.multiple,
  719. associatedTerms: obj.associatedTerms,
  720. callback: function() {
  721. that.multiSelectEntity = [], that.$(".multiSelectTag,.multiSelectTerm").hide(),
  722. that.fetchCollection();
  723. },
  724. glossaryCollection: glossaryCollection
  725. });
  726. }) : Utils.notifyInfo({
  727. content: "There are no available terms"
  728. });
  729. },
  730. onClickAddTermBtn: function(e) {
  731. var that = this, entityGuid = $(e.currentTarget).data("guid"), obj = {
  732. guid: entityGuid,
  733. multiple: void 0,
  734. associatedTerms: void 0
  735. }, isTermMultiSelect = $(e.currentTarget).hasClass("multiSelectTerm");
  736. this.glossaryCollection.fetch({
  737. success: function(glossaryCollection) {
  738. that.assignTermModalView(glossaryCollection, obj);
  739. },
  740. reset: !0
  741. }), isTermMultiSelect && this.multiSelectEntity && this.multiSelectEntity.length ? obj.multiple = this.multiSelectEntity : entityGuid && (obj.associatedTerms = this.searchCollection.find({
  742. guid: entityGuid
  743. }).get("meanings"));
  744. },
  745. onClickTagCross: function(e) {
  746. var that = this, tagName = $(e.target).data("name"), guid = $(e.target).data("guid"), entityGuid = $(e.target).data("entityguid"), assetName = $(e.target).data("assetname");
  747. CommonViewFunction.deleteTag({
  748. tagName: tagName,
  749. guid: guid,
  750. associatedGuid: guid != entityGuid ? entityGuid : null,
  751. msg: "<div class='ellipsis-with-margin'>Remove: <b>" + _.escape(tagName) + "</b> assignment from <b>" + _.escape(assetName) + " ?</b></div>",
  752. titleMessage: Messages.removeTag,
  753. okText: "Remove",
  754. showLoader: that.showLoader.bind(that),
  755. hideLoader: that.hideLoader.bind(that),
  756. callback: function() {
  757. that.searchVent && that.searchVent.trigger("Classification:Count:Update"), that.fetchCollection();
  758. }
  759. });
  760. },
  761. onClickTermCross: function(e) {
  762. var $el = $(e.target), termGuid = $el.data("termguid"), guid = $el.data("guid"), termName = $(e.currentTarget).text(), assetname = $el.data("assetname"), meanings = this.searchCollection.find({
  763. guid: guid
  764. }).get("meanings"), that = this, termObj = _.find(meanings, {
  765. termGuid: termGuid
  766. });
  767. CommonViewFunction.removeCategoryTermAssociation({
  768. termGuid: termGuid,
  769. model: {
  770. guid: guid,
  771. relationshipGuid: termObj.relationGuid
  772. },
  773. collection: that.glossaryCollection,
  774. msg: "<div class='ellipsis-with-margin'>Remove: <b>" + _.escape(termName) + "</b> assignment from <b>" + _.escape(assetname) + "?</b></div>",
  775. titleMessage: Messages.glossary.removeTermfromEntity,
  776. isEntityView: !0,
  777. buttonText: "Remove",
  778. callback: function() {
  779. that.fetchCollection();
  780. }
  781. });
  782. },
  783. onClicknextData: function() {
  784. this.offset = this.offset + this.limit, _.extend(this.searchCollection.queryParams, {
  785. offset: this.offset
  786. }), this.value && (this.value.pageOffset = this.offset, this.triggerUrl()), this.fetchCollection(null, {
  787. next: !0
  788. });
  789. },
  790. onClickpreviousData: function() {
  791. this.offset = this.offset - this.limit, this.offset <= -1 && (this.offset = 0),
  792. _.extend(this.searchCollection.queryParams, {
  793. offset: this.offset
  794. }), this.value && (this.value.pageOffset = this.offset, this.triggerUrl()), this.fetchCollection(null, {
  795. previous: !0
  796. });
  797. },
  798. onClickCreateEntity: function(e) {
  799. var that = this;
  800. $(e.currentTarget).blur(), require([ "views/entity/CreateEntityLayoutView" ], function(CreateEntityLayoutView) {
  801. new CreateEntityLayoutView({
  802. entityDefCollection: that.entityDefCollection,
  803. typeHeaders: that.typeHeaders,
  804. searchVent: that.searchVent,
  805. callback: function() {
  806. that.fetchCollection();
  807. }
  808. });
  809. });
  810. },
  811. onCheckExcludeIncludeResult: function(e) {
  812. var flag = !1, val = $(e.currentTarget).attr("data-value");
  813. e.target.checked && (flag = !0), this.value && (this.value[val] = flag, this.triggerUrl()),
  814. _.extend(this.searchCollection.queryParams, {
  815. limit: this.limit,
  816. offset: this.offset
  817. }), this.fetchCollection();
  818. },
  819. changePageLimit: function(e, obj) {
  820. if (!obj || obj && !obj.skipViewChange) {
  821. var limit = parseInt(this.ui.showPage.val());
  822. if (0 == limit) return void this.ui.showPage.data("select2").$container.addClass("has-error");
  823. this.ui.showPage.data("select2").$container.removeClass("has-error"), this.limit = limit,
  824. this.offset = 0, this.value && (this.value.pageLimit = this.limit, this.value.pageOffset = this.offset,
  825. this.triggerUrl()), _.extend(this.searchCollection.queryParams, {
  826. limit: this.limit,
  827. offset: this.offset
  828. }), this.fetchCollection();
  829. }
  830. },
  831. gotoPagebtn: function(e) {
  832. var goToPage = parseInt(this.ui.gotoPage.val());
  833. if (!(_.isNaN(goToPage) || goToPage <= -1)) {
  834. if (this.finalPage && this.finalPage < goToPage) return void Utils.notifyInfo({
  835. html: !0,
  836. content: Messages.search.noRecordForPage + "<b>" + Utils.getNumberSuffix({
  837. number: goToPage,
  838. sup: !0
  839. }) + "</b> 页"
  840. });
  841. this.offset = (goToPage - 1) * this.limit, this.offset <= -1 && (this.offset = 0),
  842. _.extend(this.searchCollection.queryParams, {
  843. limit: this.limit,
  844. offset: this.offset
  845. }), this.offset == this.pageFrom - 1 ? Utils.notifyInfo({
  846. content: Messages.search.onSamePage
  847. }) : (this.value && (this.value.pageOffset = this.offset, this.triggerUrl()), this.fetchCollection(null, {
  848. next: !0
  849. }));
  850. }
  851. }
  852. });
  853. return SearchResultLayoutView;
  854. });