ProfileLayoutView.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. define([ "require", "backbone", "hbs!tmpl/profile/ProfileLayoutView_tmpl", "collection/VProfileList", "utils/Utils", "utils/Messages", "utils/Globals" ], function(require, Backbone, ProfileLayoutViewTmpl, VProfileList, Utils, Messages, Globals) {
  2. "use strict";
  3. var ProfileLayoutView = Backbone.Marionette.LayoutView.extend({
  4. _viewName: "ProfileLayoutView",
  5. template: ProfileLayoutViewTmpl,
  6. regions: {
  7. RProfileTableOrColumnLayoutView: "#r_profileTableOrColumnLayoutView"
  8. },
  9. ui: {},
  10. templateHelpers: function() {
  11. return {
  12. profileData: this.profileData ? this.profileData.attributes : this.profileData,
  13. typeName: this.typeName
  14. };
  15. },
  16. events: function() {
  17. var events = {};
  18. return events["click " + this.ui.addTag] = "checkedValue", events;
  19. },
  20. initialize: function(options) {
  21. _.extend(this, _.pick(options, "profileData", "guid", "value", "typeName", "entityDetail", "typeHeaders", "entityDefCollection", "enumDefCollection", "classificationDefCollection", "glossaryCollection")),
  22. "hive_db" !== this.typeName && "hbase_namespace" !== this.typeName || (this.profileData = {
  23. attributes: !0
  24. });
  25. },
  26. bindEvents: function() {},
  27. onRender: function() {
  28. this.profileData && ("hive_table" === this.typeName ? this.renderProfileTableLayoutView() : "hive_db" === this.typeName || "hbase_namespace" === this.typeName ? this.renderSearchResultLayoutView() : this.renderProfileColumnLayoutView());
  29. },
  30. renderSearchResultLayoutView: function() {
  31. var that = this;
  32. require([ "views/search/SearchResultLayoutView" ], function(SearchResultLayoutView) {
  33. var value = _.extend({}, that.value, {
  34. guid: that.guid,
  35. searchType: "relationship",
  36. typeName: that.typeName
  37. });
  38. that.RProfileTableOrColumnLayoutView.show(new SearchResultLayoutView({
  39. value: value,
  40. profileDBView: !0,
  41. typeHeaders: that.typeHeaders,
  42. entityDefCollection: that.entityDefCollection,
  43. enumDefCollection: that.enumDefCollection,
  44. isTableDropDisable: !0,
  45. glossaryCollection: that.glossaryCollection,
  46. classificationDefCollection: that.classificationDefCollection
  47. }));
  48. });
  49. },
  50. renderProfileTableLayoutView: function(tagGuid) {
  51. var that = this;
  52. require([ "views/profile/ProfileTableLayoutView" ], function(ProfileTableLayoutView) {
  53. that.RProfileTableOrColumnLayoutView.show(new ProfileTableLayoutView(that.options));
  54. });
  55. },
  56. renderProfileColumnLayoutView: function(tagGuid) {
  57. var that = this;
  58. require([ "views/profile/ProfileColumnLayoutView" ], function(ProfileColumnLayoutView) {
  59. that.RProfileTableOrColumnLayoutView.show(new ProfileColumnLayoutView(that.options));
  60. });
  61. }
  62. });
  63. return ProfileLayoutView;
  64. });