main.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. var modulesLoadCount = 0, showModuleLoader = function() {
  2. 1 === modulesLoadCount && document.querySelector(".module-loader").classList.add("show-loader");
  3. }, hideModuleLoader = function() {
  4. setTimeout(function() {
  5. 0 === modulesLoadCount && (document.querySelector(".module-loader").className = "module-loader");
  6. }, 1e3);
  7. };
  8. require.config({
  9. hbs: {
  10. disableI18n: !0,
  11. helperPathCallback: function(name) {
  12. return "modules/Helpers";
  13. },
  14. templateExtension: "html",
  15. compileOptions: {}
  16. },
  17. urlArgs: "bust=" + getBustValue(),
  18. deps: [ "marionette" ],
  19. onNodeCreated: function(node, config, moduleName, url) {
  20. ++modulesLoadCount, showModuleLoader(), node.addEventListener("load", function() {
  21. --modulesLoadCount, hideModuleLoader();
  22. }), node.addEventListener("error", function() {
  23. --modulesLoadCount, hideModuleLoader();
  24. });
  25. },
  26. waitSeconds: 0,
  27. shim: {
  28. backbone: {
  29. deps: [ "underscore", "jquery" ],
  30. exports: "Backbone"
  31. },
  32. "jquery-ui": {
  33. deps: [ "jquery" ]
  34. },
  35. asBreadcrumbs: {
  36. deps: [ "jquery" ],
  37. exports: "asBreadcrumbs"
  38. },
  39. bootstrap: {
  40. deps: [ "jquery" ],
  41. exports: "jquery"
  42. },
  43. underscore: {
  44. exports: "_"
  45. },
  46. marionette: {
  47. deps: [ "backbone" ]
  48. },
  49. backgrid: {
  50. deps: [ "backbone" ],
  51. exports: "Backgrid"
  52. },
  53. "backgrid-paginator": {
  54. deps: [ "backbone", "backgrid" ]
  55. },
  56. "backgrid-filter": {
  57. deps: [ "backbone", "backgrid" ]
  58. },
  59. "backgrid-orderable": {
  60. deps: [ "backbone", "backgrid" ]
  61. },
  62. "backgrid-sizeable": {
  63. deps: [ "backbone", "backgrid" ]
  64. },
  65. "backgrid-select-all": {
  66. deps: [ "backbone", "backgrid" ]
  67. },
  68. "backgrid-columnmanager": {
  69. deps: [ "backbone", "backgrid" ]
  70. },
  71. hbs: {
  72. deps: [ "underscore", "handlebars" ]
  73. },
  74. d3: {
  75. exports: [ "d3" ]
  76. },
  77. "d3-tip": {
  78. deps: [ "d3" ],
  79. exports: [ "d3-tip" ]
  80. },
  81. LineageHelper: {
  82. deps: [ "d3" ]
  83. },
  84. dagreD3: {
  85. deps: [ "d3" ],
  86. exports: [ "dagreD3" ]
  87. },
  88. sparkline: {
  89. deps: [ "jquery" ],
  90. exports: [ "sparkline" ]
  91. },
  92. pnotify: {
  93. exports: [ "pnotify" ]
  94. },
  95. "jquery-placeholder": {
  96. deps: [ "jquery" ]
  97. },
  98. "query-builder": {
  99. deps: [ "jquery" ]
  100. },
  101. daterangepicker: {
  102. deps: [ "jquery", "moment" ]
  103. },
  104. "moment-timezone": {
  105. deps: [ "moment" ]
  106. },
  107. moment: {
  108. exports: [ "moment" ]
  109. },
  110. jstree: {
  111. deps: [ "jquery" ]
  112. },
  113. "jquery-steps": {
  114. deps: [ "jquery" ]
  115. }
  116. },
  117. paths: {
  118. jquery: "libs/jquery/js/jquery.min",
  119. underscore: "libs/underscore/underscore-min",
  120. bootstrap: "libs/bootstrap/js/bootstrap.min",
  121. backbone: "libs/backbone/backbone-min",
  122. "backbone.babysitter": "libs/backbone.babysitter/lib/backbone.babysitter.min",
  123. marionette: "libs/backbone-marionette/backbone.marionette.min",
  124. "backbone.paginator": "libs/backbone-paginator/backbone.paginator.min",
  125. "backbone.wreqr": "libs/backbone-wreqr/backbone.wreqr.min",
  126. backgrid: "libs/backgrid/js/backgrid",
  127. "backgrid-filter": "libs/backgrid-filter/js/backgrid-filter.min",
  128. "backgrid-orderable": "libs/backgrid-orderable-columns/js/backgrid-orderable-columns",
  129. "backgrid-paginator": "libs/backgrid-paginator/js/backgrid-paginator.min",
  130. "backgrid-sizeable": "libs/backgrid-sizeable-columns/js/backgrid-sizeable-columns",
  131. "backgrid-columnmanager": "external_lib/backgrid-columnmanager/js/Backgrid.ColumnManager",
  132. asBreadcrumbs: "libs/jquery-asBreadcrumbs/js/jquery-asBreadcrumbs.min",
  133. d3: "libs/d3/d3.min",
  134. "d3-tip": "libs/d3/index",
  135. LineageHelper: "external_lib/atlas-lineage/dist/index",
  136. dagreD3: "libs/dagre-d3/dagre-d3.min",
  137. sparkline: "libs/sparkline/jquery.sparkline.min",
  138. tmpl: "templates",
  139. "requirejs.text": "libs/requirejs-text/text",
  140. handlebars: "external_lib/require-handlebars-plugin/js/handlebars",
  141. hbs: "external_lib/require-handlebars-plugin/js/hbs",
  142. i18nprecompile: "external_lib/require-handlebars-plugin/js/i18nprecompile",
  143. select2: "libs/select2/select2.full.min",
  144. "backgrid-select-all": "libs/backgrid-select-all/backgrid-select-all.min",
  145. moment: "libs/moment/js/moment.min",
  146. "moment-timezone": "libs/moment-timezone/moment-timezone-with-data.min",
  147. "jquery-ui": "external_lib/jquery-ui/jquery-ui.min",
  148. pnotify: "external_lib/pnotify/pnotify.custom.min",
  149. "pnotify.buttons": "external_lib/pnotify/pnotify.custom.min",
  150. "pnotify.confirm": "external_lib/pnotify/pnotify.custom.min",
  151. "jquery-placeholder": "libs/jquery-placeholder/js/jquery.placeholder",
  152. platform: "libs/platform/platform",
  153. "query-builder": "libs/jQueryQueryBuilder/js/query-builder.standalone.min",
  154. daterangepicker: "libs/bootstrap-daterangepicker/js/daterangepicker",
  155. "table-dragger": "libs/table-dragger/table-dragger",
  156. jstree: "libs/jstree/jstree.min",
  157. "jquery-steps": "libs/jquery-steps/jquery.steps.min",
  158. dropzone: "libs/dropzone/js/dropzone-amd-module",
  159. "lossless-json": "libs/lossless-json/lossless-json"
  160. },
  161. enforceDefine: !1
  162. }), require([ "App", "router/Router", "utils/Helper", "utils/CommonViewFunction", "utils/Globals", "utils/UrlLinks", "collection/VEntityList", "collection/VTagList", "utils/Enums", "utils/Overrides", "bootstrap", "d3", "select2" ], function(App, Router, Helper, CommonViewFunction, Globals, UrlLinks, VEntityList, VTagList, Enums) {
  163. var that = this;
  164. this.asyncFetchCounter = 5 + (Enums.addOnEntities.length + 1), this.entityDefCollection = new VEntityList(),
  165. this.entityDefCollection.url = UrlLinks.entitiesDefApiUrl(), this.typeHeaders = new VTagList(),
  166. this.typeHeaders.url = UrlLinks.typesApiUrl(), this.enumDefCollection = new VTagList(),
  167. this.enumDefCollection.url = UrlLinks.enumDefApiUrl(), this.enumDefCollection.modelAttrName = "enumDefs",
  168. this.classificationDefCollection = new VTagList(), this.metricCollection = new VTagList(),
  169. this.metricCollection.url = UrlLinks.metricsApiUrl(), this.metricCollection.modelAttrName = "data",
  170. this.classificationAndMetricEvent = new Backbone.Wreqr.EventAggregator(), this.businessMetadataDefCollection = new VEntityList(),
  171. this.businessMetadataDefCollection.url = UrlLinks.businessMetadataDefApiUrl(), this.businessMetadataDefCollection.modelAttrName = "businessMetadataDefs",
  172. App.appRouter = new Router({
  173. entityDefCollection: this.entityDefCollection,
  174. typeHeaders: this.typeHeaders,
  175. enumDefCollection: this.enumDefCollection,
  176. classificationDefCollection: this.classificationDefCollection,
  177. metricCollection: this.metricCollection,
  178. classificationAndMetricEvent: this.classificationAndMetricEvent,
  179. businessMetadataDefCollection: this.businessMetadataDefCollection
  180. });
  181. var startApp = function() {
  182. 0 === that.asyncFetchCounter && App.start();
  183. };
  184. CommonViewFunction.userDataFetch({
  185. url: UrlLinks.sessionApiUrl(),
  186. callback: function(response) {
  187. if (response) {
  188. if (response.userName && (Globals.userLogedIn.status = !0, Globals.userLogedIn.response = response),
  189. void 0 !== response["atlas.entity.create.allowed"] && (Globals.entityCreate = response["atlas.entity.create.allowed"]),
  190. void 0 !== response["atlas.entity.update.allowed"] && (Globals.entityUpdate = response["atlas.entity.update.allowed"]),
  191. void 0 !== response["atlas.ui.editable.entity.types"]) {
  192. var entityTypeList = response["atlas.ui.editable.entity.types"].trim().split(",");
  193. entityTypeList.length && ("*" === entityTypeList[0] ? Globals.entityTypeConfList = [] : entityTypeList.length > 0 && (Globals.entityTypeConfList = entityTypeList));
  194. }
  195. if (void 0 !== response["atlas.ui.default.version"] && (Globals.DEFAULT_UI = response["atlas.ui.default.version"]),
  196. void 0 !== response["atlas.ui.date.format"]) {
  197. Globals.dateTimeFormat = response["atlas.ui.date.format"];
  198. var dateFormatSeperated = Globals.dateTimeFormat.split(" ");
  199. dateFormatSeperated[0] && (Globals.dateFormat = dateFormatSeperated[0]);
  200. }
  201. void 0 !== response["atlas.ui.date.timezone.format.enabled"] && (Globals.isTimezoneFormatEnabled = response["atlas.ui.date.timezone.format.enabled"]),
  202. void 0 !== response["atlas.debug.metrics.enabled"] && (Globals.isDebugMetricsEnabled = response["atlas.debug.metrics.enabled"]),
  203. void 0 !== response["atlas.tasks.enabled"] && (Globals.isTasksEnabled = response["atlas.tasks.enabled"]);
  204. }
  205. --that.asyncFetchCounter, startApp();
  206. }
  207. }), this.entityDefCollection.fetch({
  208. complete: function() {
  209. that.entityDefCollection.fullCollection.comparator = function(model) {
  210. return model.get("name").toLowerCase();
  211. }, that.entityDefCollection.fullCollection.sort({
  212. silent: !0
  213. }), --that.asyncFetchCounter, startApp();
  214. }
  215. }), this.typeHeaders.fetch({
  216. complete: function() {
  217. that.typeHeaders.fullCollection.comparator = function(model) {
  218. return model.get("name").toLowerCase();
  219. }, that.typeHeaders.fullCollection.sort({
  220. silent: !0
  221. }), --that.asyncFetchCounter, startApp();
  222. }
  223. }), this.enumDefCollection.fetch({
  224. complete: function() {
  225. that.enumDefCollection.fullCollection.comparator = function(model) {
  226. return model.get("name").toLowerCase();
  227. }, that.enumDefCollection.fullCollection.sort({
  228. silent: !0
  229. }), --that.asyncFetchCounter, startApp();
  230. }
  231. }), this.classificationDefCollection.fetch({
  232. async: !0,
  233. complete: function() {
  234. that.classificationDefCollection.fullCollection.comparator = function(model) {
  235. return model.get("name").toLowerCase();
  236. }, that.classificationDefCollection.fullCollection.sort({
  237. silent: !0
  238. }), that.classificationAndMetricEvent.trigger("Classification:Count:Update"), startApp();
  239. }
  240. }), this.metricCollection.fetch({
  241. async: !0,
  242. success: function() {},
  243. complete: function() {}
  244. }), this.businessMetadataDefCollection.fetch({
  245. complete: function() {
  246. that.businessMetadataDefCollection.fullCollection.comparator = function(model) {
  247. return model.get("name").toLowerCase();
  248. }, that.businessMetadataDefCollection.fullCollection.sort({
  249. silent: !0
  250. }), --that.asyncFetchCounter, startApp();
  251. }
  252. }), CommonViewFunction.fetchRootEntityAttributes({
  253. url: UrlLinks.rootEntityDefUrl(Enums.addOnEntities[0]),
  254. entity: Enums.addOnEntities,
  255. callback: function() {
  256. --that.asyncFetchCounter, startApp();
  257. }
  258. }), CommonViewFunction.fetchRootClassificationAttributes({
  259. url: UrlLinks.rootClassificationDefUrl(Enums.addOnClassification[0]),
  260. classification: Enums.addOnClassification,
  261. callback: function() {
  262. --that.asyncFetchCounter, startApp();
  263. }
  264. });
  265. });