stub.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*##############################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################## */
  16. define([
  17. "dojo/_base/lang",
  18. "dojo/_base/fx",
  19. "dojo/_base/window",
  20. "dojo/_base/connect",
  21. "dojo/dom",
  22. "dojo/dom-style",
  23. "dojo/dom-geometry",
  24. "dojo/io-query",
  25. "dojo/ready",
  26. "hpcc/ECLPlaygroundWidget",
  27. "hpcc/GraphPageWidget",
  28. "hpcc/ResultsWidget",
  29. "hpcc/TimingPageWidget",
  30. "hpcc/TimingTreeMapWidget",
  31. "hpcc/ECLSourceWidget",
  32. "hpcc/InfoGridWidget",
  33. "hpcc/WUQueryWidget",
  34. "hpcc/WUDetailsWidget",
  35. "hpcc/GetDFUWorkunitsWidget",
  36. "hpcc/DFUWUDetailsWidget",
  37. "hpcc/DFUWUQueryWidget",
  38. "hpcc/LFDetailsWidget"
  39. ], function (lang, fx, baseWindow, connect, dom, domStyle, domGeometry, ioQuery, ready,
  40. ECLPlaygroundWidget, GraphPageWidget, ResultsWidget, TimingPageWidget, TimingTreeMapWidget, ECLSourceWidget, InfoGridWidget, WUQueryWidget, WUDetailsWidget, GetDFUWorkunitsWidget, DFUWUDetailsWidget, DFUWUQueryWidget, LFDetailsWidget
  41. ) {
  42. var initUi = function () {
  43. var params = ioQuery.queryToObject(dojo.doc.location.search.substr((dojo.doc.location.search.substr(0, 1) == "?" ? 1 : 0)));
  44. //TODO: Can we get rid of the required dependency above?
  45. var widget = new (eval(params.Widget))({
  46. id: "app",
  47. "class": "hpccApp"
  48. });
  49. if (widget) {
  50. widget.placeAt(dojo.body(), "last");
  51. widget.startup();
  52. widget.init(params);
  53. }
  54. },
  55. startLoading = function (targetNode) {
  56. var overlayNode = dom.byId("loadingOverlay");
  57. if ("none" == domStyle.get(overlayNode, "display")) {
  58. var coords = domGeometry.getMarginBox(targetNode || baseWindow.body());
  59. domGeometry.setMarginBox(overlayNode, coords);
  60. domStyle.set(dom.byId("loadingOverlay"), {
  61. display: "block",
  62. opacity: 1
  63. });
  64. }
  65. },
  66. endLoading = function () {
  67. fx.fadeOut({
  68. node: dom.byId("loadingOverlay"),
  69. duration: 175,
  70. onEnd: function (node) {
  71. domStyle.set(node, "display", "none");
  72. }
  73. }).play();
  74. };
  75. return {
  76. init: function () {
  77. startLoading();
  78. ready(function () {
  79. initUi();
  80. endLoading();
  81. });
  82. }
  83. };
  84. });